Housekeeping
This commit is contained in:
parent
909cc1b480
commit
aaa70e12eb
16
src/uxn11.c
16
src/uxn11.c
|
@ -139,9 +139,9 @@ emu_event(Uxn *u)
|
||||||
case Expose:
|
case Expose:
|
||||||
XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * uxn_screen.scale, uxn_screen.height * uxn_screen.scale);
|
XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * uxn_screen.scale, uxn_screen.height * uxn_screen.scale);
|
||||||
break;
|
break;
|
||||||
case ClientMessage: {
|
case ClientMessage:
|
||||||
emu_end(u);
|
emu_end(u);
|
||||||
} break;
|
break;
|
||||||
case KeyPress: {
|
case KeyPress: {
|
||||||
KeySym sym;
|
KeySym sym;
|
||||||
char buf[7];
|
char buf[7];
|
||||||
|
@ -178,10 +178,8 @@ emu_event(Uxn *u)
|
||||||
} break;
|
} break;
|
||||||
case MotionNotify: {
|
case MotionNotify: {
|
||||||
XMotionEvent *e = (XMotionEvent *)&ev;
|
XMotionEvent *e = (XMotionEvent *)&ev;
|
||||||
int ex = (e->x - PAD) / uxn_screen.scale;
|
int x = clamp((e->x - PAD) / uxn_screen.scale, 0, uxn_screen.width - 1);
|
||||||
int ey = (e->y - PAD) / uxn_screen.scale;
|
int y = clamp((e->y - PAD) / uxn_screen.scale, 0, uxn_screen.height - 1);
|
||||||
int x = clamp(ex, 0, uxn_screen.width - 1);
|
|
||||||
int y = clamp(ey, 0, uxn_screen.height - 1);
|
|
||||||
mouse_pos(u, &u->dev[0x90], x, y);
|
mouse_pos(u, &u->dev[0x90], x, y);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
@ -244,10 +242,10 @@ emu_run(Uxn *u, char *rom)
|
||||||
read(fds[1].fd, expirations, 8);
|
read(fds[1].fd, expirations, 8);
|
||||||
uxn_eval(u, u->dev[0x20] << 8 | u->dev[0x21]);
|
uxn_eval(u, u->dev[0x20] << 8 | u->dev[0x21]);
|
||||||
if(uxn_screen.x2) {
|
if(uxn_screen.x2) {
|
||||||
int s = uxn_screen.scale;
|
int x = uxn_screen.x1 * uxn_screen.scale, y = uxn_screen.y1 * uxn_screen.scale;
|
||||||
int x1 = uxn_screen.x1 * s, y1 = uxn_screen.y1 * s, x2 = uxn_screen.x2 * s, y2 = uxn_screen.y2 * s;
|
int w = uxn_screen.x2 * uxn_screen.scale - x, h = uxn_screen.y2 * uxn_screen.scale - y;
|
||||||
screen_redraw(u);
|
screen_redraw(u);
|
||||||
XPutImage(display, window, DefaultGC(display, 0), ximage, x1, y1, x1 + PAD, y1 + PAD, x2 - x1, y2 - y1);
|
XPutImage(display, window, DefaultGC(display, 0), ximage, x, y, x + PAD, y + PAD, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((fds[2].revents & POLLIN) != 0) {
|
if((fds[2].revents & POLLIN) != 0) {
|
||||||
|
|
Loading…
Reference in New Issue