12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #include "JoyCtrl.h"
- JoyCtrl::JoyCtrl(InputAndJoy* input)
- :HardCtrl(input)
- {
-
- }
- JoyCtrl::~JoyCtrl()
- {
-
- }
- void JoyCtrl::update()
- {
-
- m_mvt.setVecteur( (float)m_input->getAxeValue(0) / 32768, (float)m_input->getAxeValue(1) / -32768);
-
- Vec move( (float)m_input->getAxeValue(3) / 14000, (float)m_input->getAxeValue(4) / -14000 );
- float norme( move.norme() );
- move.setX( move.getX() * norme * norme * norme );
- move.setY( move.getY() * norme * norme * norme );
- m_visee += move;
- if ( m_visee.getX() > m_input->getWinHalfW() )
- m_visee.setX( m_input->getWinHalfW() );
- else if ( m_visee.getX() < -m_input->getWinHalfW() )
- m_visee.setX( -m_input->getWinHalfW() );
- if ( m_visee.getY() > m_input->getWinHalfH() )
- m_visee.setY( m_input->getWinHalfH() );
- else if ( m_visee.getY() < -m_input->getWinHalfH() )
- m_visee.setY( -m_input->getWinHalfH() );
-
- m_tir[ L_HAND ] = m_input->getBoutonPad(4);
- m_tir[ R_HAND ] = m_input->getBoutonPad(5);
-
- m_search[ L_HAND ] = m_input->getBoutonPad(2);
- m_search[ R_HAND ] = m_input->getBoutonPad(1);
-
- m_craft = m_input->getBoutonPad(3);
- }
|