Mouse pointer dissapears using SDL_FULLSCREEN?

Started by
4 comments, last by Simagery 18 years, 12 months ago
Hi there. I've been working on my SDL game engine for a couple of weeks now and I've just done my 1st game with it. It's actually mostly nicked from Cone's GFX with SDL tutorials...well except for the engine bit. I'd be really grateful if you'd take a look, have a play, look at the code and give me some feedback as to general design, things that need adding. Etc. One problem I'm having though is that the mouse pointer dissapears when using SDL_FULLSCREEN. Any ideas? Anyway the project is built with dev-c++ and can be found here if you fancy a go. Thanks.
Gary.Goodbye, and thanks for all the fish.
Advertisement
Yes, when you use fullscreen, the cursor does indeed disappear and SDL_ShowCursor( true ); will not bring it back [sad]. So what you have to do is make your own little cursor, perhaps a 16x16 BMP and use that instead. It will get a little tricky to get perfect, but the general idea is this:
- Update Mouse Coords- Draw Game- Draw Cursor Last (so it's on top)


That's about it really, you might want to add in some smoothing of the movements if it starts to tear a lot. Give that a shot and see if you can get what you want.
Bugger!!

Okay. Thanks Drew..:)
Gary.Goodbye, and thanks for all the fish.
Using a manually programmed in cursor will also allow you to have absolute control over the user. If you want to force the mouse in a square, you can do that. Oh, and make sure you use the change of x and y instead of updating the cursor to the location of mouse.
Rob Loach [Website] [Projects] [Contact]
So use the relative x and y as opposed to the absolute x and y values?

One question. I assume that a programatic pointer will work as well in non-fullscreen mode?
Gary.Goodbye, and thanks for all the fish.
Yes, you just need to be sure to hide SDL's cursor first using SDL_ShowCursor(false).

This topic is closed to new replies.

Advertisement