MapEditor beginner problem
OK after two weeks of being in game development i finally made my first map editor, but i have a problem. When i click the leftbutton and hold it, it puts a tile only where i first clicked, not on every place that i went through while the button was down. What should i change in my code(WinAPI):
case WM_LBUTTONDOWN:
if(LOWORD(lParam)/TILESIZE<maptilesx&&HIWORD(lParam)/TILESIZE<maptilesy)
ChangeTile(LOWORD(lParam)/TILESIZE+viewpointx,HIWORD(lParam)/TILESIZE+viewpointy,selected_tile);
ProcessFrame();
break;
How can we talk about the reason of our lives if we ourselves did not choose to live ?
The code was outputted messy, here''s the actual one:
case WM_LBUTTONDOWN:
if(LOWORD(lParam)/TILESIZE
ChangeTile(LOWORD(lParam)/TILESIZE+viewpointx,HIWORD(lParam)/TILESIZE+viewpointy,selected_tile);
ProcessFrame();
break;
case WM_LBUTTONDOWN:
if(LOWORD(lParam)/TILESIZE
ChangeTile(LOWORD(lParam)/TILESIZE+viewpointx,HIWORD(lParam)/TILESIZE+viewpointy,selected_tile);
ProcessFrame();
break;
AGAIN. Sorry, i use the pre tag now.
case WM_LBUTTONDOWN: if(!choose_tile) { if(LOWORD(lParam)/TILESIZE ChangeTile(LOWORD(lParam)/TILESIZE+viewpointx,HIWORD(lParam)/TILESIZE+viewpointy,selected_tile); ProcessFrame(); } break;
AGAIN?????
sorry it was due to the less sign, changed to $$$ now
sorry it was due to the less sign, changed to $$$ now
case WM_LBUTTONDOWN: if(!choose_tile) { if(LOWORD(lParam)/TILESIZE$$$maptilesx&&HIWORD(lParam)/TILESIZE$$$maptilesy) ChangeTile(LOWORD(lParam)/TILESIZE+viewpointx,HIWORD(lParam)/TILESIZE+viewpointy,selected_tile); ProcessFrame(); } break;
next time just use the code or source tags
also erase/delete your prior posts.
(go to edit, click the checkbox, and click Make Modifications)
[code] [/code][ source ] [ /source ] (just remove the spaces)
also erase/delete your prior posts.
(go to edit, click the checkbox, and click Make Modifications)
You receive WM_LBUTTONDOWN only when the mouse button goes down. What you also need to check is WM_MOUSEMOVE. It receives the mouse position AND the button flags, check if the left button is down and set a tile there too.
THanks, but if you could be more specific like what exactly i should write because things like
don''t seem to work
case WM_MOUSEMOVE&&WM_LBUTTONDOWN:
and
case WM_MOUSEMOVE:
if (wParam==WM_LBUTTONDOWN)
don''t seem to work
you would write it:
case condition1:
case condition2:
//code
break;
I dont think that's what you want though,
More like you should have a variable indicate whether or not the left mouse button is pressed using WM_LBUTTONDOWN and WM_LBUTTONUP...
say something like this..
Is that what you want?
[edited by - JohnyB on March 8, 2004 2:10:09 AM]
case condition1:
case condition2:
//code
break;
I dont think that's what you want though,
More like you should have a variable indicate whether or not the left mouse button is pressed using WM_LBUTTONDOWN and WM_LBUTTONUP...
say something like this..
BOOL lButtonDown = FALSE; //... case WM_LBUTTONDOWN: if(wParam == MK_LBUTTON) lButtonDown = TRUE; break; case WM_LBUTTONUP: if(lButtonDown) lButtonDown = FALSE; break;
Is that what you want?
[edited by - JohnyB on March 8, 2004 2:10:09 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement