38 lines
921 B
C++
38 lines
921 B
C++
#include "core/global_inputs.hpp"
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include "core/jinput.hpp"
|
|
#include "core/screen.hpp"
|
|
|
|
namespace GlobalInputs {
|
|
|
|
static bool f1_was_pressed = false;
|
|
static bool f2_was_pressed = false;
|
|
static bool f3_was_pressed = false;
|
|
|
|
void handle() {
|
|
// F1 — decrement zoom
|
|
bool f1 = JI_KeyPressed(SDL_SCANCODE_F1);
|
|
if (f1 && !f1_was_pressed) {
|
|
Screen::get()->decZoom();
|
|
}
|
|
f1_was_pressed = f1;
|
|
|
|
// F2 — increment zoom
|
|
bool f2 = JI_KeyPressed(SDL_SCANCODE_F2);
|
|
if (f2 && !f2_was_pressed) {
|
|
Screen::get()->incZoom();
|
|
}
|
|
f2_was_pressed = f2;
|
|
|
|
// F3 — toggle fullscreen
|
|
bool f3 = JI_KeyPressed(SDL_SCANCODE_F3);
|
|
if (f3 && !f3_was_pressed) {
|
|
Screen::get()->toggleFullscreen();
|
|
}
|
|
f3_was_pressed = f3;
|
|
}
|
|
|
|
} // namespace GlobalInputs
|