add hotkey (R) for rotation
This commit is contained in:
parent
5ac98b6203
commit
944c00b89e
20
src/main.cpp
20
src/main.cpp
@ -1095,6 +1095,14 @@ int main(int argc, char **argv) {
|
||||
msaa_texture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (selected_tile != -1 && ImGui::IsWindowFocused() && ImGui::IsKeyPressed(ImGuiKey_R, false)) {
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift)) {
|
||||
selected_rotation = (selected_rotation - 1) & 3;
|
||||
} else {
|
||||
selected_rotation = (selected_rotation + 1) & 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
@ -1143,6 +1151,8 @@ int main(int argc, char **argv) {
|
||||
if (io.WantCaptureKeyboard)
|
||||
continue;
|
||||
|
||||
SDL_Keymod modifiers = SDL_GetModState();
|
||||
|
||||
if (event.key.key == SDLK_UP || event.key.key == SDLK_W) {
|
||||
player.pos_y = clamp(0, player.pos_y + 1, map_height - 2);
|
||||
}
|
||||
@ -1166,6 +1176,16 @@ int main(int argc, char **argv) {
|
||||
if (event.key.key == SDLK_F4) {
|
||||
load_map();
|
||||
}
|
||||
|
||||
if (event.key.key == SDLK_R) {
|
||||
if (selected_tile != -1 && selected_rotation != -1) {
|
||||
if (modifiers & SDL_KMOD_SHIFT) {
|
||||
selected_rotation = (selected_rotation - 1) & 3;
|
||||
} else {
|
||||
selected_rotation = (selected_rotation + 1) & 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user