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

Started by
1 comment, last by SpaceRook 22 years, 6 months ago
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).
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
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

This topic is closed to new replies.

Advertisement