Log in

View Full Version : Flicker mouse cursor, part2


lakibuk
12-12-2003, 04:13 AM
I am still trying to implement a non-flickering mouse cursor for a windowed directx game.
Solutions i have found out:
1) directx help: attach a clipper to the primary surface
Sounds easy but doesn't help anything.
2.) setCursor(NULL) and blit your own cursor sprite
Ok,i did this but the results are not very pretty (still flickering at window edges,strange mouse speed on some systems).

I know there must be a way to use the system cursor without flickering. All PopCap games do it. And they use directX.
Has anybody found out how it works?

Kai-Peter
12-12-2003, 05:56 AM
Hmm. Space Station Manager uses DX and runs with a nice solid cursor. I think the key is that I use windows messages instead of DirecInput to get input from the system. I had a *lot* of problems with DirectInput, and it offered no real advantage for a non-action based game. I never had any problems with flickering once I switched to windows messages.

You might want to download the SSM demo and edit "config.scm" to run it in windowed mode. If it flickers I need to do something about it myself, otherwise I can help with the problem immediately.. :)

patrox
12-12-2003, 06:21 AM
Originally posted by lakibuk
I am still trying to implement a non-flickering mouse cursor for a windowed directx game.
Solutions i have found out:
1) directx help: attach a clipper to the primary surface
Sounds easy but doesn't help anything.
2.) setCursor(NULL) and blit your own cursor sprite
Ok,i did this but the results are not very pretty (still flickering at window edges,strange mouse speed on some systems).

I know there must be a way to use the system cursor without flickering. All PopCap games do it. And they use directX.
Has anybody found out how it works?


They grab the system cursor in a surface and add a color key to it.

GetCursor to get the handle on it
DrawIcon to draw it into a DC

then hide the system cursor and draw your own, it'll look like the real thing ;)

pat.

lakibuk
12-12-2003, 07:45 AM
thank you,

@Kai-Peter: tried SSM, no problems with the cursor. How are you doing that?

@patrox: Sounds complicated but i will try it if i find no other way. Why do you know that PopCap uses this method?

patrox
12-12-2003, 09:08 AM
I don't, but if your card doesn't have hardware cursor there's no miracle, you'll get flickering and the only way ( well the only i know of ) to get the current cursor is GetCursor

I used the GetCursor technique in a desktop videograbber tool so i could also grab the mouse cursor with the video.

pat.