uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit d97fa9e8b873eaa2f740ab4f9abcf86bd6087079
parent 7cc77a47f40f13303f71b263cd0f60c4a2d6fb52
Author: neauoire <aliceffekt@gmail.com>
Date:   Wed, 25 Oct 2023 14:16:23 -0700

Added F12 to toggle borderless

Diffstat:
MREADME.md | 1+
Msrc/uxnemu.c | 15++++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -101,6 +101,7 @@ uxnemu orca.rom | shim - `F4` reboot - `F5` soft reboot - `F11` toggle fullscreen +- `F12` toggle decorations ### GUI Buttons diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -56,7 +56,7 @@ static SDL_Thread *stdin_thread; /* devices */ static int window_created = 0; -static int fullscreen = 0; +static int fullscreen = 0, borderless = 0; static Uint32 stdin_event, audio0_event, zoom = 1; static Uint64 exec_deadline, deadline_interval, ms_interval; @@ -189,9 +189,9 @@ set_zoom(Uint8 z, int win) } static void -set_fullscreen(int new_fullscreen, int win) +set_fullscreen(int value, int win) { - fullscreen = new_fullscreen; + fullscreen = value; Uint32 flags = 0; /* windowed mode; SDL2 has no constant for this */ if(fullscreen) { flags = SDL_WINDOW_FULLSCREEN_DESKTOP; @@ -200,6 +200,13 @@ set_fullscreen(int new_fullscreen, int win) SDL_SetWindowFullscreen(emu_window, flags); } +static void +set_borderless(int value) +{ + borderless = value; + SDL_SetWindowBordered(emu_window, !value); +} + /* emulator primitives */ int @@ -405,6 +412,8 @@ handle_events(Uxn *u) emu_restart(u, boot_rom, 1); else if(event.key.keysym.sym == SDLK_F11) set_fullscreen(!fullscreen, 1); + else if(event.key.keysym.sym == SDLK_F12) + set_borderless(!borderless); ksym = event.key.keysym.sym; if(SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_KEYUP, SDL_KEYUP) == 1 && ksym == event.key.keysym.sym) return 1;