1234567891011121314151617181920212223242526272829303132333435363738 |
- //
- // 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->getMouseKey(1);
- // Shield activation
- m_shield = m_input->getMouseKey(3);
- // Jumping
- m_jump = m_input->getKey(SDL_SCANCODE_SPACE);
- // Movement
- m_move.SetZero();
- if (m_input->getKey(SDL_SCANCODE_W))
- m_move.y = -1.0f;
- else if (m_input->getKey(SDL_SCANCODE_S))
- m_move.y = 1.0f;
- if (m_input->getKey(SDL_SCANCODE_D))
- m_move.x = 1.0f;
- else if (m_input->getKey(SDL_SCANCODE_A))
- m_move.x = -1.0f;
- // Visor
- m_visor.x = (float) m_input->getXFromCenter();
- m_visor.y = (float) m_input->getYFromCenter();
- m_visor.Normalize();
- }
|