Michael Bonfils | 1 Aug 2006 18:07
Picon
Favicon

Re: Why is this programme bad

Krzysztof Pos?uszny wrote:

1/ you use klaw but it is not allocated
2/ you never use it in SDL_BlitSurface
3/ you don't check if event is a keyboard event

try something like that

bool quit = false;
while( !quit ) {
	if ( SDL_PollEvent( &event ) {
		if ( event.type == SDL_KEYDOWN ) {
			switch(event.key.keysym.sym) {
				case SDLK_UP:klaw.x=20;break;
				case SDLK_LEFT:klaw.y=20;break;
			}
		}
	}

	SDL_BlitSurface(kula,NULL,screen, &klaw );
	SDL_Flip(screen);		
	
}

--

-- 
Michael Bonfils ( http://www.murlock.org )
membre de http://www.guses.org

Gmane