Changing cursor in C++/SDL possible?

Post: #1
Hello all,

I"m starting to get into game development. I know C++ and chose SDL to start learning. I'm up to creating a full screen tiled 2d game where the user can move a ship with the keyboard (basic stuff). Now i was wondering if it is possible to change the cursor to an image.

Thanks, Ed
Quote this message in a reply
Posts: 713
Joined: 2002.04
Post: #2
If you want a proper image (i.e colour, animation, et al) as your cursor, you'll need to use a SDL_Surface as the cursor, polling for SDL_MOUSEMOTION events and updating that surface's position to the mouse position during the update loop, and with a call to SDL_ShowCursor( SDL_DISABLE ) to hide the system cursor.

If you don't mind your cursor having all the limitations of the lowest common denominator system cursor, look at SDL_CreateCursor()

Mark Bishop
Student and freelance OS X & iOS developer
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Hiding the Cursor in Carbon? DoG 1 2,955 Feb 17, 2006 02:33 AM
Last Post: DoG
  Cursor coordinates off during resolution change akb825 2 4,000 Aug 19, 2005 08:21 PM
Last Post: akb825