ja tenim el control de la finestra i de la imatge
treballant en les tecles de funcio
This commit is contained in:
37
source/core/global_inputs.cpp
Normal file
37
source/core/global_inputs.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user