Mouse cursor and SDL_Flip

I’ve been trying to get a decent mouse under Win98, full-screen, using
double buffering and SDL_Flip. Some observations:

  1. The built-in SDL software mouse cursor works in the presence of
    ’SDL_UpdateRect’, but not with ‘SDL_Flip’. This is shame. Fixing this
    should be a simple case of sandwiching the actual page flip between calls to
    ’SDL_EraseCursor’ and ‘SDL_DrawCursor’. Right?

  2. ‘SDL_INIT_EVENTTHREAD’ is still not supported under Windows. This means
    that a truly responsive cursor is still impossible. Is anybody working on
    this?

  3. It should be possible to circumvent the need for 'SDL_INIT_EVENTTHREAD’
    by liberally sprinkling the main loop with calls to ‘SDL_PumpEvents’, right?

  4. The recommended way of creating a responsive colorful cursor is to write
    an event filter that draws the cursor. This method seems flawed, however.
    Such an event filter would need direct access to the front buffer, but SDL
    only allows access to the back buffer. The alternative (drawing to the back
    buffer and using ‘UpdateRect’) is flawed because it either results in visual
    artifacts (if cursor updates are allowed while drawing to the back surface)
    or it lacks responsiveness (if they’re not).–
    Rainer Deyke (root at rainerdeyke.com)
    Shareware computer games - http://rainerdeyke.com
    "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

I’ve been trying to get a decent mouse under Win98, full-screen, using
double buffering and SDL_Flip. Some observations:

  1. The built-in SDL software mouse cursor works in the presence of
    ’SDL_UpdateRect’, but not with ‘SDL_Flip’. This is shame. Fixing this
    should be a simple case of sandwiching the actual page flip between calls to
    ’SDL_EraseCursor’ and ‘SDL_DrawCursor’. Right?

It’s not that simple. I don’t have time to explain it in detail, but try it,
and you’ll see what I mean.

  1. ‘SDL_INIT_EVENTTHREAD’ is still not supported under Windows. This means
    that a truly responsive cursor is still impossible. Is anybody working on
    this?

It’s on the TODO list for 1.3

  1. It should be possible to circumvent the need for 'SDL_INIT_EVENTTHREAD’
    by liberally sprinkling the main loop with calls to ‘SDL_PumpEvents’, right?

Theoretically, yes.

  1. The recommended way of creating a responsive colorful cursor is to write
    an event filter that draws the cursor. This method seems flawed, however.
    Such an event filter would need direct access to the front buffer, but SDL
    only allows access to the back buffer. The alternative (drawing to the back
    buffer and using ‘UpdateRect’) is flawed because it either results in visual
    artifacts (if cursor updates are allowed while drawing to the back surface)
    or it lacks responsiveness (if they’re not).

That’s correct when working with page flipped buffers. Part of the problem
is that you suddenly have to keep track of the location of the mouse cursor
on each flipping page, as well as be able to write to the front buffer.

These are all good points, and hopefully they will be better addressed in
SDL 1.3.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software