SDL Event : Plusieur touche?

Bonjour,

Comment avec SDL Event gerer plusieur toucher comme?
J'ai essayer "case SDLK_LEFT + SDLK_UP :" mais ca na pas l'air de marcher...

Quelq'un pourait m'aider SVP?
--
?*µ¤m@$

2 réponses

  • Votes
  • Date
  • Date décroissante
  1. 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
    }