Added window padding

This commit is contained in:
Devine Lu Linvega 2022-06-15 09:10:13 -07:00
parent 0c6dec9fc8
commit fdb52a7480
2 changed files with 5 additions and 4 deletions

View File

@ -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."

View File

@ -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);