Jump to content
  • Advertisement

Archived

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

Damocles

ShowCursor(bool) stops working (windows problem)

This topic is 5279 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 use ShowCursor(BOOL) to hide or display the cursor in my game (hide it in fullscreen mode, show it in windowed mode). It works great. However, when I switch from windowed to fullscreen mode, then adjust the window using: AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); MoveWindow(hWnd, 0,0, config->videoX, config->videoY, true); I then call ShowCursor(FALSE); afterwards but the cursor remains. I have no idea why as it works fine after I first create the window, but if I move it the ShowCursor function seems to stop working. Does anyone know why this is or a good alternative to showcursor?

Share this post


Link to post
Share on other sites
Advertisement
Are you matching SetCursor(TRUE) and SetCursor(FALSE) calls? The function only updates an internal counter (TRUE adds 1, FALSE subtracts 1). When the counter is 0 or less the cursor is hidden.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites
That was it - thanks. Once again I fail to see the logic in the Windows API - of course the mouse cursour should be counted, why use a bool when you can just count?

*mumbles something obscene about Bill Gates*

Share this post


Link to post
Share on other sites
it''s based back on the fact that some people don''t had a mouse in windows. if there wasn''t, the counter got set to 0, else, to 1.

and that made it possible that you could, similar to refcounting, simply add one, to get it 100% visible, or subtract one, to remove it 100%, while the default state didn''t mathered.

sort of. it''s described in more detail in the petzold win32 book.

anyways, the BOOL it takes is to hide it from the user, as, normally, he shouldn''t bother about that refcounting. he should just set it false, and true again.

but yes, win32 api is ''fun'' to code in:D




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

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!