diff options
| author | untodesu <kirill@untode.su> | 2026-01-05 02:20:01 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2026-01-05 02:20:01 +0500 |
| commit | 915e52157208af9b41dd52892e7138c8c440e85b (patch) | |
| tree | 718224dbf69a1fdf557131a648c34e60dbdca25d /src/game/client/entity | |
| parent | a1c83d56f41e6f2e0ad86dcd76d1446bfc60a37c (diff) | |
| download | voxelius-915e52157208af9b41dd52892e7138c8c440e85b.tar.bz2 voxelius-915e52157208af9b41dd52892e7138c8c440e85b.zip | |
Progress
Diffstat (limited to 'src/game/client/entity')
| -rw-r--r-- | src/game/client/entity/player_look.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/game/client/entity/player_look.cc b/src/game/client/entity/player_look.cc index c3b7dbd..9788efb 100644 --- a/src/game/client/entity/player_look.cc +++ b/src/game/client/entity/player_look.cc @@ -25,7 +25,7 @@ #include "client/gui/settings.hh" #include "client/io/gamepad.hh" -#include "client/io/glfw.hh" +#include "client/io/mouse.hh" #include "client/const.hh" #include "client/globals.hh" @@ -71,32 +71,32 @@ static void add_angles(float pitch, float yaw) } } -static void on_glfw_cursor_pos(const GlfwCursorPosEvent& event) +static void on_cursor_pos(const CursorPosEvent& event) { if(gamepad::available && gamepad::active.get_value()) { // The player is assumed to be using // a gamepad instead of mouse and keyboard - last_cursor = event.pos; + last_cursor = event.position(); return; } if(globals::gui_screen || !session::is_ingame()) { // UI is visible or we're not in-game - last_cursor = event.pos; + last_cursor = event.position(); return; } - auto dx = -0.01f * static_cast<float>(mouse_sensitivity.get_value()) * math::radians(event.pos.x - last_cursor.x); - auto dy = -0.01f * static_cast<float>(mouse_sensitivity.get_value()) * math::radians(event.pos.y - last_cursor.y); + auto dx = -0.01f * static_cast<float>(mouse_sensitivity.get_value()) * math::radians(event.xpos() - last_cursor.x); + auto dy = -0.01f * static_cast<float>(mouse_sensitivity.get_value()) * math::radians(event.ypos() - last_cursor.y); add_angles(dy, dx); - last_cursor = event.pos; + last_cursor = event.position(); } static void on_gamepad_button(const GamepadButtonEvent& event) { - if(button_fastlook.equals(event.button)) { - fastlook_enabled = event.action == GLFW_PRESS; + if(button_fastlook.equals(event.button())) { + fastlook_enabled = event.is_action(GLFW_PRESS); } } @@ -126,7 +126,7 @@ void player_look::init(void) last_cursor.x = 0.5f * static_cast<float>(globals::width); last_cursor.y = 0.5f * static_cast<float>(globals::height); - globals::dispatcher.sink<GlfwCursorPosEvent>().connect<&on_glfw_cursor_pos>(); + globals::dispatcher.sink<CursorPosEvent>().connect<&on_cursor_pos>(); globals::dispatcher.sink<GamepadButtonEvent>().connect<&on_gamepad_button>(); } |
