- removed 386 CR characters - removed 4 trailing whitespaces - replaced 189 tabs with spaceslegacy
| @@ -215,7 +215,7 @@ int main(int argc, char **argv) | |||||
| new DebugFps(5, 5); | new DebugFps(5, 5); | ||||
| new Cube(); | new Cube(); | ||||
| controller = new Controller(KEY_MAX, AXIS_MAX); | |||||
| controller = new Controller(KEY_MAX, AXIS_MAX); | |||||
| controller->GetKey(KEY_MANUAL_ROTATION).Bind("Keyboard", "Space"); | controller->GetKey(KEY_MANUAL_ROTATION).Bind("Keyboard", "Space"); | ||||
| controller->GetKey(KEY_DRAG_MESH).Bind("Mouse", "ButtonLeft"); | controller->GetKey(KEY_DRAG_MESH).Bind("Mouse", "ButtonLeft"); | ||||
| controller->GetAxis(AXIS_DRAG_PITCH).Bind("Mouse", "Y"); | controller->GetAxis(AXIS_DRAG_PITCH).Bind("Mouse", "Y"); | ||||
| @@ -175,7 +175,7 @@ public: | |||||
| rcmplx worldmouse = m_center + rcmplx(ScreenToWorldOffset(m_mousepos)); | rcmplx worldmouse = m_center + rcmplx(ScreenToWorldOffset(m_mousepos)); | ||||
| uint32_t buttons = 0; | |||||
| uint32_t buttons = 0; | |||||
| //uint32_t buttons = Input::GetMouseButtons(); | //uint32_t buttons = Input::GetMouseButtons(); | ||||
| #if !defined __CELLOS_LV2__ && !defined _XBOX | #if !defined __CELLOS_LV2__ && !defined _XBOX | ||||
| if (buttons & 0x2) | if (buttons & 0x2) | ||||
| @@ -24,19 +24,19 @@ namespace lol | |||||
| void KeyBinding::Bind(const char* device_name, const char* key_name) | void KeyBinding::Bind(const char* device_name, const char* key_name) | ||||
| { | { | ||||
| m_device = InputDevice::Get(device_name); | |||||
| if (!m_device) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name); | |||||
| return; | |||||
| } | |||||
| m_keyindex = m_device->GetKeyIndex(key_name); | |||||
| if (m_keyindex < 0) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to key %s.%s which doesn't exist", device_name, key_name); | |||||
| } | |||||
| m_device = InputDevice::Get(device_name); | |||||
| if (!m_device) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name); | |||||
| return; | |||||
| } | |||||
| m_keyindex = m_device->GetKeyIndex(key_name); | |||||
| if (m_keyindex < 0) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to key %s.%s which doesn't exist", device_name, key_name); | |||||
| } | |||||
| } | } | ||||
| /////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// | ||||
| @@ -44,19 +44,19 @@ void KeyBinding::Bind(const char* device_name, const char* key_name) | |||||
| void AxisBinding::Bind(const char* device_name, const char* axis_name) | void AxisBinding::Bind(const char* device_name, const char* axis_name) | ||||
| { | { | ||||
| m_device = InputDevice::Get(device_name); | |||||
| if (!m_device) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name); | |||||
| return; | |||||
| } | |||||
| m_axisindex = m_device->GetAxisIndex(axis_name); | |||||
| if (m_axisindex < 0) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to axis %s.%s which doesn't exist", device_name, axis_name); | |||||
| } | |||||
| m_device = InputDevice::Get(device_name); | |||||
| if (!m_device) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to device %s which doesn't exist", device_name); | |||||
| return; | |||||
| } | |||||
| m_axisindex = m_device->GetAxisIndex(axis_name); | |||||
| if (m_axisindex < 0) | |||||
| { | |||||
| Log::Warn("Trying to bind controller to axis %s.%s which doesn't exist", device_name, axis_name); | |||||
| } | |||||
| } | } | ||||
| @@ -67,79 +67,79 @@ Array<Controller*> Controller::controllers; | |||||
| Controller::Controller(int nb_keys, int nb_axis) | Controller::Controller(int nb_keys, int nb_axis) | ||||
| { | { | ||||
| m_gamegroup = GAMEGROUP_BEFORE; | |||||
| m_nb_keys = nb_keys; | |||||
| m_nb_axis = nb_axis; | |||||
| m_keys = new KeyBinding[m_nb_keys]; | |||||
| m_axis = new AxisBinding[m_nb_axis]; | |||||
| m_activate_nextframe = false; | |||||
| m_deactivate_nextframe = false; | |||||
| m_active = false; | |||||
| controllers.Push(this); | |||||
| m_gamegroup = GAMEGROUP_BEFORE; | |||||
| m_nb_keys = nb_keys; | |||||
| m_nb_axis = nb_axis; | |||||
| m_keys = new KeyBinding[m_nb_keys]; | |||||
| m_axis = new AxisBinding[m_nb_axis]; | |||||
| m_activate_nextframe = false; | |||||
| m_deactivate_nextframe = false; | |||||
| m_active = false; | |||||
| controllers.Push(this); | |||||
| } | } | ||||
| Controller::~Controller() | Controller::~Controller() | ||||
| { | { | ||||
| for (int i = 0; i < controllers.Count(); ++i) | |||||
| { | |||||
| if (controllers[i] == this) | |||||
| { | |||||
| controllers.Remove(i); | |||||
| break; | |||||
| } | |||||
| } | |||||
| for (int i = 0; i < controllers.Count(); ++i) | |||||
| { | |||||
| if (controllers[i] == this) | |||||
| { | |||||
| controllers.Remove(i); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| void Controller::TickGame(float seconds) | void Controller::TickGame(float seconds) | ||||
| { | { | ||||
| Entity::TickGame(seconds); | |||||
| Entity::TickGame(seconds); | |||||
| for (int i = 0; i < m_nb_keys; ++i) | |||||
| { | |||||
| m_keys[i].Update(); | |||||
| } | |||||
| for (int i = 0; i < m_nb_keys; ++i) | |||||
| { | |||||
| m_keys[i].Update(); | |||||
| } | |||||
| for (int i = 0; i < m_nb_axis; ++i) | |||||
| { | |||||
| m_axis[i].Update(); | |||||
| } | |||||
| for (int i = 0; i < m_nb_axis; ++i) | |||||
| { | |||||
| m_axis[i].Update(); | |||||
| } | |||||
| if (m_activate_nextframe) | |||||
| m_active = true; | |||||
| if (m_activate_nextframe) | |||||
| m_active = true; | |||||
| if (m_deactivate_nextframe) | |||||
| m_active = false; | |||||
| if (m_deactivate_nextframe) | |||||
| m_active = false; | |||||
| m_activate_nextframe = false; | |||||
| m_deactivate_nextframe = false; | |||||
| m_activate_nextframe = false; | |||||
| m_deactivate_nextframe = false; | |||||
| } | } | ||||
| void Controller::Activate() | void Controller::Activate() | ||||
| { | { | ||||
| m_activate_nextframe = true; | |||||
| m_deactivate_nextframe = false; | |||||
| m_activate_nextframe = true; | |||||
| m_deactivate_nextframe = false; | |||||
| } | } | ||||
| void Controller::Deactivate() | void Controller::Deactivate() | ||||
| { | { | ||||
| m_deactivate_nextframe = true; | |||||
| m_activate_nextframe = false; | |||||
| m_deactivate_nextframe = true; | |||||
| m_activate_nextframe = false; | |||||
| } | } | ||||
| Array<Controller*> Controller::DeactivateAll() | Array<Controller*> Controller::DeactivateAll() | ||||
| { | { | ||||
| Array<Controller*> result; | |||||
| for (int i = 0; i < controllers.Count(); ++i) | |||||
| { | |||||
| if (controllers[i]->m_active || controllers[i]->m_activate_nextframe) | |||||
| { | |||||
| result.Push(controllers[i]); | |||||
| controllers[i]->Deactivate(); | |||||
| } | |||||
| } | |||||
| return result; | |||||
| Array<Controller*> result; | |||||
| for (int i = 0; i < controllers.Count(); ++i) | |||||
| { | |||||
| if (controllers[i]->m_active || controllers[i]->m_activate_nextframe) | |||||
| { | |||||
| result.Push(controllers[i]); | |||||
| controllers[i]->Deactivate(); | |||||
| } | |||||
| } | |||||
| return result; | |||||
| } | } | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -21,77 +21,77 @@ namespace lol | |||||
| class KeyBinding | class KeyBinding | ||||
| { | { | ||||
| public: | public: | ||||
| KeyBinding() : m_current(false), m_previous(false), m_device(nullptr) {} | |||||
| KeyBinding() : m_current(false), m_previous(false), m_device(nullptr) {} | |||||
| bool IsDown() const { return m_current; } | |||||
| bool IsUp() const { return !m_current; } | |||||
| bool IsPressed() const { return m_current && !m_previous; } | |||||
| bool IsReleased() const { return !m_current && m_previous; } | |||||
| bool IsDown() const { return m_current; } | |||||
| bool IsUp() const { return !m_current; } | |||||
| bool IsPressed() const { return m_current && !m_previous; } | |||||
| bool IsReleased() const { return !m_current && m_previous; } | |||||
| void Bind(const char* device_name, const char* key_name); | |||||
| void Bind(const char* device_name, const char* key_name); | |||||
| protected: | protected: | ||||
| void Update() { m_previous = m_current; m_current = m_device ? m_device->GetKey(m_keyindex) : false; } | |||||
| void Update() { m_previous = m_current; m_current = m_device ? m_device->GetKey(m_keyindex) : false; } | |||||
| const InputDevice* m_device; | |||||
| int m_keyindex; | |||||
| bool m_current; | |||||
| bool m_previous; | |||||
| const InputDevice* m_device; | |||||
| int m_keyindex; | |||||
| bool m_current; | |||||
| bool m_previous; | |||||
| friend class Controller; | |||||
| friend class Controller; | |||||
| }; | }; | ||||
| class AxisBinding | class AxisBinding | ||||
| { | { | ||||
| public: | public: | ||||
| AxisBinding() : m_current(0.0f), m_previous(0.0f), m_device(nullptr) {} | |||||
| AxisBinding() : m_current(0.0f), m_previous(0.0f), m_device(nullptr) {} | |||||
| float GetValue() const { return m_current; } | |||||
| float GetDelta() const { return m_current - m_previous; } | |||||
| float GetValue() const { return m_current; } | |||||
| float GetDelta() const { return m_current - m_previous; } | |||||
| void Bind(const char* device_name, const char* axis_name); | |||||
| void Bind(const char* device_name, const char* axis_name); | |||||
| protected: | protected: | ||||
| void Update() { m_previous = m_current; m_current = m_device ? m_device->GetAxis(m_axisindex) : 0.0f; } | |||||
| void Update() { m_previous = m_current; m_current = m_device ? m_device->GetAxis(m_axisindex) : 0.0f; } | |||||
| const InputDevice* m_device; | |||||
| int m_axisindex; | |||||
| float m_current; | |||||
| float m_previous; | |||||
| const InputDevice* m_device; | |||||
| int m_axisindex; | |||||
| float m_current; | |||||
| float m_previous; | |||||
| friend class Controller; | |||||
| friend class Controller; | |||||
| }; | }; | ||||
| class Controller : Entity | class Controller : Entity | ||||
| { | { | ||||
| public: | public: | ||||
| Controller(int nb_keys, int nb_axis); | |||||
| ~Controller(); | |||||
| Controller(int nb_keys, int nb_axis); | |||||
| ~Controller(); | |||||
| virtual void TickGame(float seconds); | |||||
| virtual void TickGame(float seconds); | |||||
| /** Activate the controller on next frame */ | |||||
| void Activate(); | |||||
| /** Deactivate the controller on next frame */ | |||||
| void Deactivate(); | |||||
| /** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */ | |||||
| static Array<Controller*> DeactivateAll(); | |||||
| /** Activate the controller on next frame */ | |||||
| void Activate(); | |||||
| /** Deactivate the controller on next frame */ | |||||
| void Deactivate(); | |||||
| /** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */ | |||||
| static Array<Controller*> DeactivateAll(); | |||||
| KeyBinding& GetKey(int index) { ASSERT(index >= 0 && index < m_nb_keys); return m_keys[index]; } | |||||
| AxisBinding& GetAxis(int index) { ASSERT(index >= 0 && index < m_nb_axis); return m_axis[index]; } | |||||
| KeyBinding& GetKey(int index) { ASSERT(index >= 0 && index < m_nb_keys); return m_keys[index]; } | |||||
| AxisBinding& GetAxis(int index) { ASSERT(index >= 0 && index < m_nb_axis); return m_axis[index]; } | |||||
| protected: | protected: | ||||
| KeyBinding* m_keys; | |||||
| AxisBinding* m_axis; | |||||
| int m_nb_keys; | |||||
| int m_nb_axis; | |||||
| KeyBinding* m_keys; | |||||
| AxisBinding* m_axis; | |||||
| int m_nb_keys; | |||||
| int m_nb_axis; | |||||
| private: | private: | ||||
| static Array<Controller*> controllers; | |||||
| bool m_activate_nextframe; | |||||
| bool m_deactivate_nextframe; | |||||
| bool m_active; | |||||
| static Array<Controller*> controllers; | |||||
| bool m_activate_nextframe; | |||||
| bool m_deactivate_nextframe; | |||||
| bool m_active; | |||||
| }; | }; | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -55,11 +55,11 @@ public: | |||||
| /** Get an input device by its name */ | /** Get an input device by its name */ | ||||
| static InputDevice* Get(const char* name) { return GetDevice(name); } | static InputDevice* Get(const char* name) { return GetDevice(name); } | ||||
| /** Set whether the mouse cursor should be captured. */ | |||||
| static void CaptureMouse(bool activated) { m_capturemouse = activated; } | |||||
| /** Set whether the mouse cursor should be captured. */ | |||||
| static void CaptureMouse(bool activated) { m_capturemouse = activated; } | |||||
| protected: | protected: | ||||
| // TODO: hide all of this in a InputDeviceData? | |||||
| // TODO: hide all of this in a InputDeviceData? | |||||
| String m_name; | String m_name; | ||||
| @@ -74,7 +74,7 @@ protected: | |||||
| /** cursor position */ | /** cursor position */ | ||||
| Array<vec2, ivec2> m_cursors; | Array<vec2, ivec2> m_cursors; | ||||
| static bool m_capturemouse; | |||||
| static bool m_capturemouse; | |||||
| InputDevice(const char* name) : m_name(name) | InputDevice(const char* name) : m_name(name) | ||||
| { | { | ||||
| @@ -29,12 +29,12 @@ public: | |||||
| void AddCursor(const char* name); | void AddCursor(const char* name); | ||||
| void SetKey(int index, bool state) { m_keys[index] = state; } | void SetKey(int index, bool state) { m_keys[index] = state; } | ||||
| void SetAxis(int index, float value) { m_axis[index].m1 = value; } | |||||
| void SetCursor(int index, const vec2& position, const ivec2& pixel) { m_cursors[index].m1 = position; m_cursors[index].m2 = pixel; } | |||||
| void SetAxis(int index, float value) { m_axis[index].m1 = value; } | |||||
| void SetCursor(int index, const vec2& position, const ivec2& pixel) { m_cursors[index].m1 = position; m_cursors[index].m2 = pixel; } | |||||
| static bool GetMouseCapture() { return m_capturemouse; } | |||||
| static bool GetMouseCapture() { return m_capturemouse; } | |||||
| static InputDeviceInternal* CreateStandardKeyboard(); | |||||
| static InputDeviceInternal* CreateStandardKeyboard(); | |||||
| static InputDeviceInternal* CreateStandardMouse(); | static InputDeviceInternal* CreateStandardMouse(); | ||||
| }; | }; | ||||
| @@ -59,14 +59,14 @@ D3d9Input::D3d9Input() | |||||
| if (XInputGetState(i, &state) != ERROR_SUCCESS) | if (XInputGetState(i, &state) != ERROR_SUCCESS) | ||||
| continue; | continue; | ||||
| #if defined LOL_INPUT_V2 | #if defined LOL_INPUT_V2 | ||||
| // TODO: we can put more friendly name here, such as LeftAxisX, ButtonX... | |||||
| InputDeviceInternal* stick = new InputDeviceInternal(String::Printf("Joystick%d", i+1).C()); | |||||
| for (int j = 0; j < 4; ++j) | |||||
| stick->AddAxis(String::Printf("Axis%d", j+1).C()); | |||||
| for (int j = 0; j < 16; ++j) | |||||
| stick->AddKey(String::Printf("Button%d", j+1).C()); | |||||
| m_data->m_joysticks.Push(i, stick); | |||||
| // TODO: we can put more friendly name here, such as LeftAxisX, ButtonX... | |||||
| InputDeviceInternal* stick = new InputDeviceInternal(String::Printf("Joystick%d", i+1).C()); | |||||
| for (int j = 0; j < 4; ++j) | |||||
| stick->AddAxis(String::Printf("Axis%d", j+1).C()); | |||||
| for (int j = 0; j < 16; ++j) | |||||
| stick->AddKey(String::Printf("Button%d", j+1).C()); | |||||
| m_data->m_joysticks.Push(i, stick); | |||||
| #else | #else | ||||
| Stick *stick = Input::CreateStick(); | Stick *stick = Input::CreateStick(); | ||||
| stick->SetAxisCount(4); | stick->SetAxisCount(4); | ||||
| @@ -86,11 +86,11 @@ D3d9Input::~D3d9Input() | |||||
| while (m_data->m_joysticks.Count()) | while (m_data->m_joysticks.Count()) | ||||
| { | { | ||||
| #if defined LOL_INPUT_V2 | #if defined LOL_INPUT_V2 | ||||
| delete m_data->m_joysticks[0].m2; | |||||
| delete m_data->m_joysticks[0].m2; | |||||
| #else | #else | ||||
| Input::DestroyStick(m_data->m_joysticks[0].m2); | |||||
| Input::DestroyStick(m_data->m_joysticks[0].m2); | |||||
| #endif // LOL_INPUT_V2 | #endif // LOL_INPUT_V2 | ||||
| m_data->m_joysticks.Remove(0); | |||||
| m_data->m_joysticks.Remove(0); | |||||
| } | } | ||||
| #endif | #endif | ||||
| delete m_data; | delete m_data; | ||||
| @@ -119,11 +119,11 @@ void D3d9Input::TickDraw(float seconds) | |||||
| for (int b = 0; b < 16; b++) | for (int b = 0; b < 16; b++) | ||||
| #if defined LOL_INPUT_V2 | #if defined LOL_INPUT_V2 | ||||
| m_data->m_joysticks[i].m2->SetKey(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1); | |||||
| m_data->m_joysticks[i].m2->SetKey(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1); | |||||
| #else | #else | ||||
| m_data->m_joysticks[i].m2->SetButton(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1); | |||||
| m_data->m_joysticks[i].m2->SetButton(b, ((uint16_t)(state.Gamepad.wButtons) >> b) & 1); | |||||
| #endif // LOL_INPUT_V2 | #endif // LOL_INPUT_V2 | ||||
| } | |||||
| } | |||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -67,9 +67,9 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||||
| } | } | ||||
| # ifdef LOL_INPUT_V2 | # ifdef LOL_INPUT_V2 | ||||
| const SDL_VideoInfo* vidinfo = SDL_GetVideoInfo(); | |||||
| int screen_w = vidinfo->current_w; | |||||
| int screen_h = vidinfo->current_h; | |||||
| const SDL_VideoInfo* vidinfo = SDL_GetVideoInfo(); | |||||
| int screen_w = vidinfo->current_w; | |||||
| int screen_h = vidinfo->current_h; | |||||
| # endif | # endif | ||||
| # if defined USE_D3D9 | # if defined USE_D3D9 | ||||
| @@ -84,7 +84,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||||
| SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | ||||
| SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); | ||||
| # ifdef LOL_INPUT_V2 | # ifdef LOL_INPUT_V2 | ||||
| // TODO: when implementing fullscreen, be sure to overwrite screen_w and screen_h with the value of vidinfo after the call to SDL_SetVideoMode | |||||
| // TODO: when implementing fullscreen, be sure to overwrite screen_w and screen_h with the value of vidinfo after the call to SDL_SetVideoMode | |||||
| # endif | # endif | ||||
| SDL_Surface *video = SDL_SetVideoMode(res.x, res.y, 0, SDL_OPENGL); | SDL_Surface *video = SDL_SetVideoMode(res.x, res.y, 0, SDL_OPENGL); | ||||
| # endif | # endif | ||||
| @@ -112,7 +112,7 @@ SdlApp::SdlApp(char const *title, ivec2 res, float fps) : | |||||
| # ifdef LOL_INPUT_V2 | # ifdef LOL_INPUT_V2 | ||||
| new SdlInput(video->w, video->h, screen_w, screen_h); | new SdlInput(video->w, video->h, screen_w, screen_h); | ||||
| # else | # else | ||||
| new SdlInput(); | |||||
| new SdlInput(); | |||||
| # endif | # endif | ||||
| #endif | #endif | ||||
| } | } | ||||
| @@ -53,7 +53,7 @@ private: | |||||
| SdlInputData(int app_w, int app_h, int screen_w, int screen_h) : | SdlInputData(int app_w, int app_h, int screen_w, int screen_h) : | ||||
| m_prevmouse(ivec2(0)), | m_prevmouse(ivec2(0)), | ||||
| m_app_w((float)app_w), | m_app_w((float)app_w), | ||||
| m_app_h((float)app_h), | |||||
| m_app_h((float)app_h), | |||||
| m_screen_w((float)screen_w), | m_screen_w((float)screen_w), | ||||
| m_screen_h((float)screen_h) | m_screen_h((float)screen_h) | ||||
| { } | { } | ||||
| @@ -239,7 +239,7 @@ void SdlInputData::Tick(float seconds) | |||||
| } | } | ||||
| # if !SDL_FORCE_POLL_JOYSTICK | # if !SDL_FORCE_POLL_JOYSTICK | ||||
| # ifdef LOL_INPUT_V2 | |||||
| # ifdef LOL_INPUT_V2 | |||||
| case SDL_JOYAXISMOTION: | case SDL_JOYAXISMOTION: | ||||
| m_joysticks[event.jaxis.which].m2->SetAxis(event.jaxis.axis, (float)event.jaxis.value / 32768.f); | m_joysticks[event.jaxis.which].m2->SetAxis(event.jaxis.axis, (float)event.jaxis.value / 32768.f); | ||||
| break; | break; | ||||
| @@ -248,7 +248,7 @@ void SdlInputData::Tick(float seconds) | |||||
| case SDL_JOYBUTTONDOWN: | case SDL_JOYBUTTONDOWN: | ||||
| m_joysticks[event.jbutton.which].m2->SetKey(event.jbutton.button, event.jbutton.state); | m_joysticks[event.jbutton.which].m2->SetKey(event.jbutton.button, event.jbutton.state); | ||||
| break; | break; | ||||
| # else // !LOL_INPUT_V2 | |||||
| # else // !LOL_INPUT_V2 | |||||
| case SDL_JOYAXISMOTION: | case SDL_JOYAXISMOTION: | ||||
| m_joysticks[event.jaxis.which].m2->SetAxis(event.jaxis.axis, (float)event.jaxis.value / 32768.f); | m_joysticks[event.jaxis.which].m2->SetAxis(event.jaxis.axis, (float)event.jaxis.value / 32768.f); | ||||
| break; | break; | ||||
| @@ -257,7 +257,7 @@ void SdlInputData::Tick(float seconds) | |||||
| case SDL_JOYBUTTONDOWN: | case SDL_JOYBUTTONDOWN: | ||||
| m_joysticks[event.jbutton.which].m2->SetButton(event.jbutton.button, event.jbutton.state); | m_joysticks[event.jbutton.which].m2->SetButton(event.jbutton.button, event.jbutton.state); | ||||
| break; | break; | ||||
| # endif // LOL_INPUT_V2 | |||||
| # endif // LOL_INPUT_V2 | |||||
| # endif | # endif | ||||
| } | } | ||||
| } | } | ||||
| @@ -290,7 +290,7 @@ void SdlInputData::Tick(float seconds) | |||||
| # else // !LOL_INPUT_V2 | # else // !LOL_INPUT_V2 | ||||
| Input::SetMousePos(mouse); | Input::SetMousePos(mouse); | ||||
| # endif // LOL_INPUT_V2 | |||||
| # endif // LOL_INPUT_V2 | |||||
| # if SDL_VERSION_ATLEAST(1,3,0) | # if SDL_VERSION_ATLEAST(1,3,0) | ||||
| Uint8 *sdlstate = SDL_GetKeyboardState(nullptr); | Uint8 *sdlstate = SDL_GetKeyboardState(nullptr); | ||||
| @@ -299,14 +299,14 @@ void SdlInputData::Tick(float seconds) | |||||
| # endif | # endif | ||||
| int keyindex = 0; | int keyindex = 0; | ||||
| # ifdef LOL_INPUT_V2 | |||||
| # define KEY_FUNC(name, index) m_keyboard->SetKey(keyindex++, sdlstate[index] != 0); | |||||
| # if !defined SDLK_WORLD_0 | |||||
| # define KEY_DISABLE_WORLD | |||||
| # ifdef LOL_INPUT_V2 | |||||
| # define KEY_FUNC(name, index) m_keyboard->SetKey(keyindex++, sdlstate[index] != 0); | |||||
| # if !defined SDLK_WORLD_0 | |||||
| # define KEY_DISABLE_WORLD | |||||
| # endif // !SDLK_WORLD_0 | # endif // !SDLK_WORLD_0 | ||||
| # include "input/keys.h" | |||||
| # undef KEY_FUNC | |||||
| # else // !LOL_INPUT_V2 | |||||
| # include "input/keys.h" | |||||
| # undef KEY_FUNC | |||||
| # else // !LOL_INPUT_V2 | |||||
| /* Send the whole keyboard state to the input system */ | /* Send the whole keyboard state to the input system */ | ||||
| Array<uint8_t> &lolstate = Input::GetKeyboardState(); | Array<uint8_t> &lolstate = Input::GetKeyboardState(); | ||||
| @@ -554,7 +554,7 @@ void SdlInputData::Tick(float seconds) | |||||
| lolstate[Key::Undo] = sdlstate[SDLK_UNDO]; | lolstate[Key::Undo] = sdlstate[SDLK_UNDO]; | ||||
| UNUSED(seconds); | UNUSED(seconds); | ||||
| # endif // LOL_INPUT_V2 | |||||
| # endif // LOL_INPUT_V2 | |||||
| #endif // USE_SDL | #endif // USE_SDL | ||||
| } | } | ||||