A voir également:
- SDL Event : Plusieur touche?
- Event travel celine dion avis - Guide
- Avoir celebi soulsilver sans event - <a href="https://forums.commentcamarche.net/forum/jeux-video-19">Forum Jeux vidéo</a>
- Ou se trouve celebi dans pokemon soulsilver ✓ - <a href="https://forums.commentcamarche.net/forum/jeux-video-19">Forum Jeux vidéo</a>
- Échec du démarrage de la session « cloud files diagnostic event listener » avec l’erreur suivante : 0xc0000022 ✓ - <a href="https://forums.commentcamarche.net/forum/jeux-pc-258">Forum Jeux PC</a>
- Epson event manager ✓ - <a href="https://forums.commentcamarche.net/forum/imprimante-223">Forum Imprimante</a>
2 réponses
On peut faire :
int touche_haut=0, touche_gauche=0;
...
Puis, dans te boucle :
sdl_WaitEvent(&event);
switch(event.type)
{
case SDL_KEYDOWN:
switch(event.key.keysym.sym)
{
case SDLK_LEFT:
touche_gauche++;
break;
case SDLK_UP:
touche_haut++;
break;
}
break;
case SDL_KEYUP:
switch(event.key.keysym.sym)
{
case SDLK_LEFT:
touche_gauche--;
break;
case SDLK_UP:
touche_haut--;
break;
}
break;
}
if(touche_haut==1 && touche_gauche==1)
{
//tes instructions
}
int touche_haut=0, touche_gauche=0;
...
Puis, dans te boucle :
sdl_WaitEvent(&event);
switch(event.type)
{
case SDL_KEYDOWN:
switch(event.key.keysym.sym)
{
case SDLK_LEFT:
touche_gauche++;
break;
case SDLK_UP:
touche_haut++;
break;
}
break;
case SDL_KEYUP:
switch(event.key.keysym.sym)
{
case SDLK_LEFT:
touche_gauche--;
break;
case SDLK_UP:
touche_haut--;
break;
}
break;
}
if(touche_haut==1 && touche_gauche==1)
{
//tes instructions
}