Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

proveren

MapEditor beginner problem

This topic is 5337 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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;

Share this post


Link to post
Share on other sites
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;


Share this post


Link to post
Share on other sites
AGAIN?????
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;

Share this post


Link to post
Share on other sites
next time just use the code or source tags


[code] [/code]
[ source ] [ /source ] (just remove the spaces)


also erase/delete your prior posts.
(go to edit, click the checkbox, and click Make Modifications)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
THanks, but if you could be more specific like what exactly i should write because things like

case WM_MOUSEMOVE&&WM_LBUTTONDOWN:

and

case WM_MOUSEMOVE:
if (wParam==WM_LBUTTONDOWN)

don''t seem to work

Share this post


Link to post
Share on other sites
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..

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]

Share this post


Link to post
Share on other sites
Thanks to all that replied, I guess i would have to read a decent WinApi32bit tutorial. Johnny-B yes, i would have to do it your way.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!