Hello,
I’d like to use SDL_Flip to swap between two different images for a
given number of times with a given frequency. (We use this for visual
stimulation experiments.) Since I’m not really sure how to use this
function in this context, can anybody help me with a hint or a code
snippet? I only found an example where ONE image is shown on the screen,
modified in the background and flipped to the screen again. Could
SDL_Flip also flip between 2 DIFFERENT images, and how?
Just create a surface for every image and then blit from the image surfaces
to the “main” (screen or whatever) surface.
-Lars> ----- Original Message -----
From: unolte1@gwdg.de (Ulrike Nolte)
To:
Sent: Tuesday, May 07, 2002 1:36 AM
Subject: [SDL] SDL_Flip
Hello,
I’d like to use SDL_Flip to swap between two different images for a
given number of times with a given frequency. (We use this for visual
stimulation experiments.) Since I’m not really sure how to use this
function in this context, can anybody help me with a hint or a code
snippet? I only found an example where ONE image is shown on the screen,
modified in the background and flipped to the screen again. Could
SDL_Flip also flip between 2 DIFFERENT images, and how?
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
You could do something like this if every frame you want it to change:
SDL_Surface *PrimSurface, *Image1, *Image2; // Declare 3 surfaces, 1 for
blitting to, and 2 for source images.
int ImageNo = 1; // Declare one variable to determine which image to blit
…
if( ImageNo == 1 ) // If on Image 1,
{
SDL_BlitSurface( Image1, NULL, PrimSurface, NULL ); // Blit Image 1
ImageNo = 2; // Switch to Image 2
}
else if( ImageNo == 2 ) // Else do Image 2,
{
SDL_BlitSurface( Image2, NULL, PrimSurface, NULL ); // Blit Image 2
ImageNo = 1; // Switch to Image 1
}
SDL_Flip(PrimSurface); // Flip PrimSurface
…
This is rather crude code, but you get the idea.>From: Ulrike Nolte
Reply-To: sdl at libsdl.org
To: sdl at libsdl.org
Subject: [SDL] SDL_Flip
Date: Tue, 07 May 2002 10:36:33 +0200
Hello,
I’d like to use SDL_Flip to swap between two different images for a
given number of times with a given frequency. (We use this for visual
stimulation experiments.) Since I’m not really sure how to use this
function in this context, can anybody help me with a hint or a code
snippet? I only found an example where ONE image is shown on the screen,
modified in the background and flipped to the screen again. Could
SDL_Flip also flip between 2 DIFFERENT images, and how?
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Mike S. Codename: Freak901010
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx