• Advertisement
Sign in to follow this  

Dragging mouse to draw tiles

This topic is 4168 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

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
Advertisement
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
You could have used WM_MOUSEMOVE with the MK_LBUTTON flag..

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement