Jump to content
  • Advertisement
Sign in to follow this  
Toadhead

SDL mouse events problem

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

Hm.. I'm using a custom mouse cursor which I want to hide when I click on the right mouse. I used SDL_GetMouseState() but than I need to click realy fast to hide it. If I hold it down too long it wont work. So than I tried this, but it doesnt seem to work. Can anyone tell me what's wrong with thise code and otherwise how I can make this work on another way? (The code compiles but muse wont hide). Thanks in advance, Toadhead
if(gevent.type == SDL_MOUSEBUTTONUP)
{
//Checking for right mouse click
if(gevent.button.button == SDL_BUTTON_RIGHT)
{
if(HideMouse == true)
HideMouse = false;
else
HideMouse = true;         
}
//End of checking for right mouse click   
}


Share this post


Link to post
Share on other sites
Advertisement
Are you doing this in a loop? I imagine that you are so it is getting the mouse state again seeing that HideMouse is true (from last time) and automaticlly reseting it to false...so it reappears.

Share this post


Link to post
Share on other sites
oopsie...
I had this code within a "if(gevent.type == SDL_KEYDOWN)" statement hehe.

Anyway thanks its fixed now.

Share this post


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

  • 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!