[SDL] Why is this programme bad
Michael Bonfils
murlock at free.fr
Tue Aug 1 09:07:36 PDT 2006
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
More information about the SDL
mailing list