Sign in to follow this  
GuitarPlayer0912

Dragging mouse to draw tiles

Recommended Posts

I'm almost done with my map editor using the Win32 API in c++. It uses square tiles (32 x 32, nothing isometric), and I can easily draw them to the map with the click of a mouse. But if you have a very large area you want to draw of the same tile, clicking each square individually is a pain in the arse. This is my code for drawing tiles.
LRESULT CALLBACK WndProc(HWND hMapWnd, UINT msg, WPARAM wParam, LPARAM lParam){
  switch(msg){

    case WM_LBUTTONDOWN:
      { 
        POINT pt;
        pt.x = LOWORD(lParam); // X coordinate of mouse cursor
        pt.y = HIWORD(lParam); // Y coordinate

        DrawTile(pt); // Draws the tile to the screen according to mouse coordinate
      }
      return 0;
 
  }
}
and of course the other WM_ messages as well. Is there a message or something that is sent whenever the mouse drags or something? Any help would be appreciated.

Share this post


Link to post
Share on other sites
Never mind. Found out myself. Just made a static BOOL flag to determine if the mouse was dragging when I moved it. Gosh I hate it when I can't find an answer to a problem until 5 minutes after I post it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this