Advertisement

SDL Mouse Input

Started by March 12, 2005 04:51 PM
2 comments, last by Drew_Benton 19 years, 11 months ago
Can anyone tell me how to get Mouse Input with SDL? Any tips or tutorial links would be greatly appreciated.
My Current Project Angels 22 (4E5)
while (SDL_PollEvent(&event)) // goes through until done with each event{   switch (event.type) // differ the types of events   {      case SDL_MOUSEBUTTONUP:          // mouse button is up      break;      case SDL_MOUSEBUTTONDOWN: // see which mouse buttons were hit         if(SDL_GetMouseState(null, null)&SDL_BUTTON_LMASK)            // left mouse down         if(SDL_GetMouseState(null, null)&SDL_BUTTON_MMASK)            // middle mouse down         if(SDL_GetMouseState(null, null)&SDL_BUTTON_RMASK)            // right button down                  break;       case SDL_MOUSEMOTION:         mouseX = event.button.x;         mouseY = event.button.y;      break;    } // switch} // while


SDL Doc Project
SDL Doc Wiki
Clickomania! Tutorial

[Edited by - clayasaurus on March 12, 2005 5:04:28 PM]
Advertisement
Thx
My Current Project Angels 22 (4E5)
Also, here's a post on getting the mouse wheel if you are intrested.

This topic is closed to new replies.

Advertisement