Re : sdl surface hide query

Of course yes.

Here is pseudo code (suppose you blit on the screen surface):

if (visible) {
? blit(bigSurface, screen);
? visible = false;
else {
? blit(smallSurface, screen);
? visible = true;

You have to take care of the blit rectangles, thing that I cannot do because I ignore all the parameters for doing so. Notably, your bigger surface may not be blitted at 0,0 so you need to pay attention to assign the right coordinates.

The display surface (or any surface) hasn’t the notion of layers on it so surface visibility is just a way to abstract things. Concretly what you do is replacing an area of pixels by others. It’s all flat. If you need to manage multiple layers, do some scrolling, and have visibility managed automatically, you can give a try to my lib SDLayer:

Don’t use it if it’s just an occasional problem.

let me know it it’s unclear


— En date de?: Lun 25.5.09, jyoti a ?crit?:de: jyoti
Objet: [SDL] sdl surface hide query
?: sdl at
Date: Lundi 25 Mai 2009, 10h05


suppose there is a small surface on some other big surface. Some event occurs,
say for example- mouse click. when this event occurs, the smaller surface should
not be visible i.e. it gets hidden. when I again? click , then that smaller
surface should be visible again i.e. it should reappear.

Is there some way to do so?

SDL mailing list
SDL at