# Black/White Stripes

Hi!

I need for an experiment a stimulus with vertical repeated black/white
stripes (the whole screen) which moves from right to left.

What is the best way to realize this?

Hope anyone can help a newbie

Thanks a lot.

Greetings Walter

I would use a rectangle drawing function
from a graphics library like SDL_gfx, SGE, or Sprig (or just use
SDL_FillRect if youâ€™re comfortable with that). Then you can use an
integer variable to loop through one â€˜wavelengthâ€™ of stripes (one
black, one white).

Hereâ€™s an (untested) example using Sprig (http://pubpages.unh.edu/~jmb97).

int stripeWidth = 40; // change this to whatever

int wavePos = 0;

bool done = 0;

while(!done)

{

``````// check for events

// ...

for(int i = 0; wavePos + i * stripeWidth < screen->w; i++)

{

Uint32 color = (i%2 == 0) ? 0x000000 : 0xFFFFFF;

SPG_RectFilled(screen, wavePos + i * stripeWidth, 0, wavePos + (i+1) * stripeWidth, screen->h, color);

}

wavePos--;

if(wavePos <= -2*stripeWidth)

wavePos = 0;

// throttle framerate

// ...
``````

}

If you need help filling in the rest, just send me an email.

Jonny D> Date: Wed, 4 Jun 2008 09:10:45 +0200

From: sdl at jokawalli.de
To: sdl at lists.libsdl.org
Subject: [SDL] Black/White Stripes

Hi!

I need for an experiment a stimulus with vertical repeated black/white
stripes (the whole screen) which moves from right to left.

What is the best way to realize this?

Hope anyone can help a newbie

Thanks a lot.

Greetings Walter

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Enjoy 5 GB of free, password-protected online storage.
http://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refresh_skydrive_062008