commit fdb52a7

Devine Lu Linvega  ·  2022-06-15 16:10:13 +0000 UTC
parent 0c6dec9
Added window padding
2 files changed,  +5, -4
+1, -1
1@@ -44,6 +44,6 @@ echo "Assembling.."
2 bin/uxncli etc/drifblim.rom etc/polycat.tal && mv etc/polycat.rom bin/
3 
4 echo "Running.."
5-bin/uxn11 bin/polycat.rom
6+bin/uxn11 ~/roms/noodle.rom
7 
8 echo "Done."
+4, -3
 1@@ -36,6 +36,7 @@ char *rom_path;
 2 #define SUPPORT 0x1f07 /* devices mask */
 3 #define WIDTH (64 * 8)
 4 #define HEIGHT (40 * 8)
 5+#define PAD 4
 6 
 7 static int
 8 emu_error(char *msg, const char *err)
 9@@ -101,7 +102,7 @@ static void
10 emu_draw(void)
11 {
12 	screen_redraw(&uxn_screen, uxn_screen.pixels);
13-	XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, 0, 0, uxn_screen.width, uxn_screen.height);
14+	XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width, uxn_screen.height);
15 }
16 
17 static int
18@@ -196,7 +197,7 @@ emu_event(Uxn *u)
19 	} break;
20 	case MotionNotify: {
21 		XMotionEvent *e = (XMotionEvent *)&ev;
22-		mouse_pos(u, &u->dev[0x90], e->x, e->y);
23+		mouse_pos(u, &u->dev[0x90], e->x - PAD, e->y - PAD);
24 	} break;
25 	}
26 }
27@@ -207,7 +208,7 @@ display_start(char *title)
28 	Atom wmDelete;
29 	display = XOpenDisplay(NULL);
30 	visual = DefaultVisual(display, 0);
31-	window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width, uxn_screen.height, 1, 0, 0);
32+	window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width + PAD * 2, uxn_screen.height + PAD * 2, 1, 0, 0);
33 	if(visual->class != TrueColor)
34 		return emu_error("Init", "True-color visual failed");
35 	XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask);