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: 714
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
  changing mouse icon in cocoa Leroy 13 11,460 Sep 4, 2007 07:10 PM
Last Post: SethWillits
  Hiding the Cursor in Carbon? DoG 1 3,800 Feb 17, 2006 02:33 AM
Last Post: DoG
  Cursor coordinates off during resolution change akb825 2 5,218 Aug 19, 2005 08:21 PM
Last Post: akb825