El codigo que tengo hasta el moment es este:
- Código: Seleccionar todo
while(ejecuta)
{
miPersonaje.dibujarImagen(pantalla);
while(SDL_PollEvent(&evento))
{
if(evento.type == SDL_QUIT)
{
ejecuta = false;
}
else
{
if (evento.type == SDL_KEYDOWN)
{
if(evento.key.keysym.sym == SDLK_UP)
{
val = val+5;
}
}
if (evento.type == SDL_KEYUP)
{
if(evento.key.keysym.sym == SDLK_UP)
{
rectangulo.x = miPersonaje.getX();
rectangulo.y = miPersonaje.getY();
rectangulo.h = miPersonaje.getAltura();
rectangulo.w = miPersonaje.getAncho();
SDL_FillRect(pantalla,&rectangulo,SDL_MapRGB(pantalla->format,0,0,0));
miPersonaje.setY(miPersonaje.getY()+val);
miPersonaje.dibujarImagen(pantalla);
SDL_Flip(pantalla); }
}
}
}
}