123456789101112131415161718192021222324252627282930313233343536373839 |
- //
- // Created by jovian on 18/07/17.
- //
- #include "MouseCtrl.h"
- MouseCtrl::MouseCtrl(Input *input) : m_input(input) {
- }
- void MouseCtrl::refresh() {
- // Firing
- m_firing = m_input->getKey(SDL_SCANCODE_SPACE);
- // Shield activation
- m_shield = m_input->getKey(SDL_SCANCODE_S);
- // Boosting
- m_boost = m_input->getMouseKey(1);
- // Visor
- m_visor.x = (float) m_input->getXFromCenter();
- m_visor.y = (float) m_input->getYFromCenter();
- m_visor.Normalize();
- // Acceleration
- if (m_input->getKey(SDL_SCANCODE_Z))
- m_acceleration = 1.0f;
- else
- m_acceleration = 0.0f;
- // Torque
- if (m_input->getKey(SDL_SCANCODE_A))
- m_torque = -1.0f;
- else if (m_input->getKey(SDL_SCANCODE_D))
- m_torque = 1.0f;
- else
- m_torque = 0.0f;
- }
|