Historique des modifications - Message

Message #11777

Sujet: Relachement d'une touche


Type Date Auteur Contenu
Création du message 19-03-2017 18:19:08 Magun
quelque chose comme ça ?

Code c++ :


class blablabla
{
    public:
        blablabla() :
            joystic_left_forward_down(true)
            joystic_left_forward_up(false)
        {
        }
        
        virtual bool blablabla::OnEvent(const SEvent& event)
        {
            if(event.EventType == irr::EET_KEY_INPUT_EVENT)
            {
                if(event.KeyInput.Key ==  irr::KEY_KEY_A)
                {
                    player->forward(event.KeyInput.PressedDown);
                }
            }
            if(event.EventType == irr::EET_JOYSTICK_INPUT_EVENT)
            {
                if(event.JoystickEvent.Axis[1] <  -5000) 
                {
                    // single emit
                    if(joystic_left_forward_down)
                    {
                        irr::SEvent event;
                            event.EventType = EET_KEY_INPUT_EVENT;
                            event.KeyInput.Key = irr::KEY_KEY_A;
                            event.KeyInput.PressedDown = true;
                        device->postEventFromUser(event);
                        joystic_left_forward_up = true;
                        joystic_left_forward_down = false;
                    }
                }
                else
                {
                    // single emit
                    if(joystic_left_forward_up)
                    {
                        irr::SEvent event;
                            event.EventType = EET_KEY_INPUT_EVENT;
                            event.KeyInput.Key = irr::KEY_KEY_A;
                            event.KeyInput.PressedDown = false;
                        device->postEventFromUser(event);
                        joystic_left_forward_up = false;
                        joystic_left_forward_down = true;
                    }
                }
            }
        }
    private:
        bool joystic_left_forward_up;
        bool joystic_left_forward_down;
};

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
158 invités en ligne
membre en ligne: -
RSS Feed