[SDL] Fast array->Screen routine.....

Kenneth Christensen fessor at fessor.net
Tue Jun 5 11:46:30 PDT 2001


Hi!

new to this list, so this subject may have been discussed before..

currently writing a game in a 320x240x24 resolution, so i started out by
creating an unsigned char Array wish I wanted to contain my pixels ( doing a
lot of pixel based operations )

but my problem is that I only get 20 fps on a K6-2 350 and 60fps on a Cel
466 BOTH running with a TNT2 under windows .. have i made a serious error
somewhere in my "Copy-from-array-to-screen"-routine or ?

anyways.. it goes like this:
// ----
		if ( SDL_LockSurface(video) == 0 )
		{
			int row;
		      Uint8 *src, *dst;

			src = myscreen;
			dst = (Uint8 *)video->pixels;

	            memcpy(dst,src,230400); // ( 320*240*3 = 230400)

			SDL_UnlockSurface(video);
		}
		SDL_UpdateRect(video, 0, 0, 0, 0);
// ----


...Kenneth "fessor" Christensen




More information about the SDL mailing list