From 00d2ff90866e85bd98b23159d8c59b5c18f87f02 Mon Sep 17 00:00:00 2001 From: Vankata453 <78196474+Vankata453@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:55:16 +0200 Subject: [PATCH] `EditorOverlayWidget`: Numpad support for switching between autotilesets --- src/editor/overlay_widget.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/editor/overlay_widget.cpp b/src/editor/overlay_widget.cpp index 33e5b9dbd5..2ccdd60059 100644 --- a/src/editor/overlay_widget.cpp +++ b/src/editor/overlay_widget.cpp @@ -1182,13 +1182,17 @@ EditorOverlayWidget::on_key_down(const SDL_KeyboardEvent& key) { alt_pressed = true; } - else if (sym == SDLK_0) + else if (sym == SDLK_0 || sym == SDLK_KP_0) { m_current_autotileset = 0; } - else if (sym > SDLK_0 && sym <= SDLK_9) + else if (sym >= SDLK_1 && sym <= SDLK_9) { - m_current_autotileset = static_cast(sym - SDLK_0); + m_current_autotileset = static_cast(sym - SDLK_1 + 1); + } + else if (sym >= SDLK_KP_1 && sym <= SDLK_KP_9) + { + m_current_autotileset = static_cast(sym - SDLK_KP_1 + 1); } return true; }