Question about Pointer to Display Surface

Hello,

Some functions in the SDL api only seem to make sense for the display
surface, but to take a pointer to a surface as argument (usually
called “screen”). I’m thinking of functions like SDL_UpdateRect(s) and
SDL_Flip,SDL_WM_ToggleFullScreen

Am I right in thinking that…

There is only one display surface.

The SDL_GetVideoSurface returns a pointer to that surface.

This pointer is always the same as that returned by
the last SDL_SetVideoMode.

This pointer (and only this pointer) is what should be
supplied as argument to SDL_UpdateRect(s), SDL_Flip, etc…

The only reason I have doubts about this is that if the above
statements are true then SDL should already know what the current
display surface is, so the screen argument seems superfluous. But
I guess it’s there for a reason, so one or more of the above
statements might be false :frowning:

Also, is the pointer always the same (so I can reuse it again and
again), or might it change (in which case I guess I have to call
SDL_GetVideoSurface each time I need it)?

Thanks–
Adrian Hey

Maybe you can create multiple non-fullscreen displays in one
application? It’s weird, I never thought about it, I’ve always just
entered the surface variable to the functions you mention :smiley:

Marc

Adrian Hey wrote:> Hello,

Some functions in the SDL api only seem to make sense for the display
surface, but to take a pointer to a surface as argument (usually
called “screen”). I’m thinking of functions like SDL_UpdateRect(s) and
SDL_Flip,SDL_WM_ToggleFullScreen

Am I right in thinking that…

There is only one display surface.

The SDL_GetVideoSurface returns a pointer to that surface.

This pointer is always the same as that returned by
the last SDL_SetVideoMode.

This pointer (and only this pointer) is what should be
supplied as argument to SDL_UpdateRect(s), SDL_Flip, etc…

The only reason I have doubts about this is that if the above
statements are true then SDL should already know what the current
display surface is, so the screen argument seems superfluous. But
I guess it’s there for a reason, so one or more of the above
statements might be false :frowning:

Also, is the pointer always the same (so I can reuse it again and
again), or might it change (in which case I guess I have to call
SDL_GetVideoSurface each time I need it)?

Thanks

Adrian Hey


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

M.A. Oude Kotte wrote:

Maybe you can create multiple non-fullscreen displays in one
application? It’s weird, I never thought about it, I’ve always just
entered the surface variable to the functions you mention :smiley:

AFAIK, that’s not possible without hacks, but it sure would rule!
Perhaps that’s a possible extension for some later version? (low
priority of course)
Another nice thing would be to provide “official” bindings to include
SDL surfaces in common GUI toolkits like FLTK, GTK, Win32… or is there
already such a thing?

Sebastian

Hello !

Another nice thing would be to provide “official” bindings to include
SDL surfaces in common GUI toolkits like FLTK, GTK, Win32… or is there
already such a thing?

I am working on a lib to use SDL Surfaces in FLTK apps.

Like:
http://www.synolution.com/~wizard/tmp/MultiWin/
http://www.synolution.com/~wizard/tmp/MultiWin/test.jpg

I am currently digging out the best
and/or fastest way to do this.

CU

Torsten Giebl wrote:

I am working on a lib to use SDL Surfaces in FLTK apps.

Like:
http://www.synolution.com/~wizard/tmp/MultiWin/
http://www.synolution.com/~wizard/tmp/MultiWin/test.jpg

I am currently digging out the best
and/or fastest way to do this.

Wow, this is really sweet! :slight_smile:
Of course, your solution might have some performance issues, but I think
that in situations where you would want to use FLTK + SDL, speed
wouldn’t be that much of a matter.
Have you already tested how SDL events would be handled?

CU, Sebastian