From fdb52a74806f0973de911534db460b632c2a86ce Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 15 Jun 2022 09:10:13 -0700 Subject: [PATCH] Added window padding --- build.sh | 2 +- src/uxn11.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index a51b494..90ace80 100755 --- a/build.sh +++ b/build.sh @@ -44,6 +44,6 @@ echo "Assembling.." bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/ echo "Running.." -bin/uxn11 bin/polycat.rom +bin/uxn11 ~/roms/noodle.rom echo "Done." diff --git a/src/uxn11.c b/src/uxn11.c index e406e2f..b1754ef 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -36,6 +36,7 @@ char *rom_path; #define SUPPORT 0x1f07 /* devices mask */ #define WIDTH (64 * 8) #define HEIGHT (40 * 8) +#define PAD 4 static int emu_error(char *msg, const char *err) @@ -101,7 +102,7 @@ static void emu_draw(void) { screen_redraw(&uxn_screen, uxn_screen.pixels); - XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, 0, 0, uxn_screen.width, uxn_screen.height); + XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width, uxn_screen.height); } static int @@ -196,7 +197,7 @@ emu_event(Uxn *u) } break; case MotionNotify: { XMotionEvent *e = (XMotionEvent *)&ev; - mouse_pos(u, &u->dev[0x90], e->x, e->y); + mouse_pos(u, &u->dev[0x90], e->x - PAD, e->y - PAD); } break; } } @@ -207,7 +208,7 @@ display_start(char *title) Atom wmDelete; display = XOpenDisplay(NULL); visual = DefaultVisual(display, 0); - window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width, uxn_screen.height, 1, 0, 0); + window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width + PAD * 2, uxn_screen.height + PAD * 2, 1, 0, 0); if(visual->class != TrueColor) return emu_error("Init", "True-color visual failed"); XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask);