One more annoying question :)

Well, you’ll be happy to know I’ve tried almost all of the API (at least
the video part, that is all I will be using) and know how to use it now.
In fact I’ve done quite a bit of work with it. I am however stuck on the
very last function I am trying to learn. This time I have looked at the
examples and even the source code to the functions themselves. I just
can’t make it work for me.
So If you’ll just help me with the cursor routines there probably won’t
be anything left for me to bug you about.

I’m trying to do a SDL_CreateColorCursor on the “icon.bmp” in the test
directory.(mainly because I didn’t have the foggiest idea how to set up
the data and mask for SDL_CreateCursor and didn’t want to bug you guys.
So much for that) Here is a shortened version of the code I have that
doesn’t work. If I put the cursor functions before I set the video mode,
there is no cursor at all. If I put them after I set the video mode it
is just the same old cursor:

#include <stdio.h>

#include “SDL/SDL.h”

int main()
{
SDL_Cursor *Pointer;
SDL_Surface *surface;

SDL_Init(SDL_INIT_VIDEO);

surface = SDL_LoadBMP(“icon.bmp”);

Pointer = SDL_CreateColorCursor(surface, 16, 16);
SDL_SetCursor(Pointer);

SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);

SDL_Delay(5000);

SDL_Quit();
}

If I compile it just like that then I have the above problems. But that
is exactly how the testwm program had it. (except that had the cursor
functions after the setvideomode, but that didn’t work for me so I tried
moving it, which didn’t work either.

Anyhow hopefully after this I will be pretty SDL Self-Sufficient.

Thanks in advance

Well, you’ll be happy to know I’ve tried almost all of the API (at least
the video part, that is all I will be using) and know how to use it now.

Great! :slight_smile:

I’m trying to do a SDL_CreateColorCursor on the “icon.bmp” in the test
directory.(mainly because I didn’t have the foggiest idea how to set up
the data and mask for SDL_CreateCursor and didn’t want to bug you guys.
So much for that) Here is a shortened version of the code I have that
doesn’t work. If I put the cursor functions before I set the video mode,
there is no cursor at all. If I put them after I set the video mode it
is just the same old cursor:

When you create a color cursor, it’s drawn by the event code in software,
in response to mouse motion events. It starts off hidden because there’s
no internal API for getting the current mouse position (indeed one may not
even exist), but is drawn at the first mouse motion event.

If you don’t use a separate thread for events, you need to call the event
functions to drive the event loop and draw the mouse. CivCTP uses a separate
thread to handle event polling and another thread for drawing the cursor.
This isn’t supported on all platforms (Windows and MacOS), but does provide
a nice responsive mouse when the rest of the application is busy. :slight_smile:

SDL doesn’t handle software cursors very well. It tries to draw them
whenever the display surface changes, but it flickers. The best way
to do this is to mix the cursor image and your blit before it actually
gets to the screen. This requires a bit of complicated application code
though.

I dunno. Ideas? Comments?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

SDL doesn’t handle software cursors very well. It tries to draw them
whenever the display surface changes, but it flickers. The best way
to do this is to mix the cursor image and your blit before it actually
gets to the screen. This requires a bit of complicated application code
though.

I dunno. Ideas? Comments?

I noticed the flickering in some cases. Right now I’m using an ATI Xpert 128
with the FBDev Xserver. Very fast updates–slow scrolls. And the SDL cursor
flickers. Didn’t used to flicker on my S3Trio64v+ board, as I recall.

Anyway I just turned the cursor off and render another sprite to act as the
cursor. No flicker. Wouldn’t be responsive if the main program went away
for a while though, but it’s not that kind of program.