Thank u bubba & salem for giving reply. But i think that i can't tell u what i wanted to say. here is the piece of code i have refered. It uses SDL to draw on screen some wavy animation.
Code:
void render()
{
// Lock surface if needed
if (SDL_LockSurface(screen) < 0)
return;
// Ask SDL for the time in milliseconds
int tick = SDL_GetTicks();
// Declare a couple of variables
int i, j, d, yofs, ofs;
// Draw to screen
for (i = 0, yofs = 0, d = 0; i < 480; i++, yofs += screen->pitch / 4)
for (j = 0, ofs = yofs; j < 640; j++, ofs++, d++)
((unsigned int*)screen->pixels)[ofs] = 0;
for (i = 0; i < 128; i++)
{
d = tick + i * 10;
drawsprite((int)(320 + sin(d * 0.003459734f) * 300),
(int)(240 + sin(d * 0.003345973f) * 220),
((int)(sin((tick * 0.2 + i) * 0.234897f) * 127 + 128) << 16) |
((int)(sin((tick * 0.2 + i) * 0.123489f) * 127 + 128) << 8) |
((int)(sin((tick * 0.2 + i) * 0.312348f) * 127 + 128) << 0));
}
// Unlock if needed
if (SDL_MUSTLOCK(screen))
SDL_UnlockSurface(screen);
// Tell SDL to update the whole screen
SDL_UpdateRect(screen, 0, 0, 640, 480);
}