summaryrefslogtreecommitdiffstats
path: root/src/game/client/gui/hotbar.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2026-01-05 02:20:01 +0500
committeruntodesu <kirill@untode.su>2026-01-05 02:20:01 +0500
commit915e52157208af9b41dd52892e7138c8c440e85b (patch)
tree718224dbf69a1fdf557131a648c34e60dbdca25d /src/game/client/gui/hotbar.cc
parenta1c83d56f41e6f2e0ad86dcd76d1446bfc60a37c (diff)
downloadvoxelius-915e52157208af9b41dd52892e7138c8c440e85b.tar.bz2
voxelius-915e52157208af9b41dd52892e7138c8c440e85b.zip
Progress
Diffstat (limited to 'src/game/client/gui/hotbar.cc')
-rw-r--r--src/game/client/gui/hotbar.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/game/client/gui/hotbar.cc b/src/game/client/gui/hotbar.cc
index edcf8a9..14c701c 100644
--- a/src/game/client/gui/hotbar.cc
+++ b/src/game/client/gui/hotbar.cc
@@ -18,7 +18,8 @@
#include "client/gui/settings.hh"
#include "client/gui/status_lines.hh"
-#include "client/io/glfw.hh"
+#include "client/io/keyboard.hh"
+#include "client/io/mouse.hh"
#include "client/resource/texture_gui.hh"
@@ -55,11 +56,11 @@ static void update_hotbar_item(void)
}
}
-static void on_glfw_key(const GlfwKeyEvent& event)
+static void on_key(const KeyEvent& event)
{
- if((event.action == GLFW_PRESS) && !globals::gui_screen) {
+ if(event.is_action(GLFW_PRESS) && !globals::gui_screen) {
for(unsigned int i = 0U; i < HOTBAR_SIZE; ++i) {
- if(hotbar_keys[i].equals(event.key)) {
+ if(hotbar_keys[i].equals(event.keycode())) {
hotbar::active_slot = i;
update_hotbar_item();
break;
@@ -68,15 +69,15 @@ static void on_glfw_key(const GlfwKeyEvent& event)
}
}
-static void on_glfw_scroll(const GlfwScrollEvent& event)
+static void on_scroll(const ScrollEvent& event)
{
if(!globals::gui_screen) {
- if(event.dy < 0.0) {
+ if(event.yoffset() < 0.0) {
hotbar::next_slot();
return;
}
- if(event.dy > 0.0) {
+ if(event.yoffset() > 0.0) {
hotbar::prev_slot();
return;
}
@@ -118,8 +119,8 @@ void hotbar::init(void)
hotbar_background = resource::load<TextureGUI>("textures/gui/hud_hotbar.png", TEXTURE_GUI_LOAD_CLAMP_S | TEXTURE_GUI_LOAD_CLAMP_T);
hotbar_selector = resource::load<TextureGUI>("textures/gui/hud_selector.png", TEXTURE_GUI_LOAD_CLAMP_S | TEXTURE_GUI_LOAD_CLAMP_T);
- globals::dispatcher.sink<GlfwKeyEvent>().connect<&on_glfw_key>();
- globals::dispatcher.sink<GlfwScrollEvent>().connect<&on_glfw_scroll>();
+ globals::dispatcher.sink<KeyEvent>().connect<&on_key>();
+ globals::dispatcher.sink<ScrollEvent>().connect<&on_scroll>();
}
void hotbar::shutdown(void)