• Advertisement

Archived

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

Sometimes I think they are TRYING to make it hard...

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

From Tricks of the Windows Game Programming Gurus: "ShowCursor() accumulates, so if you call ShowCursor(false) 5 times, you must call ShowCursor(true) 5 times to unwind it." OK, I can envision a scenario where I *might* care how many times I call ShowCursor(false) (or true) in a row. But 99.99999% of the time, I simply juat want the system to hide the cursor, or show it. I don''t want to worry about if I called it X number of times. Why did they add this extra complexity? If people want to count how many times they make a function call, let them put their own counters in their program. It''s a big inconvenience to the rest of us. I have the cursor situation working in my program, but I am paranoid that there might be some control-flow path I didn''t take into account that will make the cursor invisible, or that will have the cursor stay visible during my game and make me look like some amateur (which of course I am).

Share this post


Link to post
Share on other sites
Advertisement
Yeah. When I first saw that, I just sat there wondering "Why is ShowCursor implemented as a semaphore?" To get around it, whenever you want to hide cursor, just keep calling the ShowCursor( FALSE ) function until the display count is -1 and the cursor is hidden. Anyways, that one's more of an annoyance than a problem. You should check out DIBs (which my GDI program needs to use heavily - long story). The scanlines are layed out from bottom to top (to maintain backwards compability of course) which means you either have do alot of scanline flipping or use some very confusing tricks with negative heights (which is what I do).



Edited by - poozer on January 28, 2002 9:13:03 PM

Share this post


Link to post
Share on other sites
I think the reason why there is a call count in ShowCursor is very usefull.
What if you make a piece of code, or use a piece of code, that needs to hide the cursor at the beginning, and then of course show it back at the end. ShowCursor/HideCursor will work perfectly.

But what if you have another piece of code that does the same thing, but calls the previous code in the middle. By counting the number of times HideCursor has been called, it prevents the cursor from reappearing at the end of the first piece of code.

----------------
Blaster
Computer game programmer and part time human being
Strategy First - http://www.strategyfirst.com
BlasterSoft - http://www.blastersoft.com

Share this post


Link to post
Share on other sites

  • Advertisement