commit eaa05f8
neauoire
·
2023-11-12 03:59:12 +0000 UTC
parent 520373d
Removed SCALE artifacts
1 files changed,
+7,
-11
+7,
-11
1@@ -35,7 +35,6 @@ static Window window;
2 #define WIDTH (64 * 8)
3 #define HEIGHT (40 * 8)
4 #define PAD 2
5-#define SCALE 1
6 #define CONINBUFSIZE 256
7
8 static int
9@@ -107,13 +106,10 @@ emu_end(Uxn *u)
10 static void
11 hide_cursor(void)
12 {
13- Cursor blank;
14- Pixmap bitmap;
15- XColor black;
16+ XColor black = {0};
17 static char empty[] = {0};
18- black.red = black.green = black.blue = 0;
19- bitmap = XCreateBitmapFromData(display, window, empty, 1, 1);
20- blank = XCreatePixmapCursor(display, bitmap, bitmap, &black, &black, 0, 0);
21+ Pixmap bitmap = XCreateBitmapFromData(display, window, empty, 1, 1);
22+ Cursor blank = XCreatePixmapCursor(display, bitmap, bitmap, &black, &black, 0, 0);
23 XDefineCursor(display, window, blank);
24 XFreeCursor(display, blank);
25 XFreePixmap(display, bitmap);
26@@ -181,8 +177,8 @@ emu_event(Uxn *u)
27 } break;
28 case MotionNotify: {
29 XMotionEvent *e = (XMotionEvent *)&ev;
30- int x = clamp((e->x - PAD) / SCALE, 0, uxn_screen.width - 1);
31- int y = clamp((e->y - PAD) / SCALE, 0, uxn_screen.height - 1);
32+ int x = clamp((e->x - PAD), 0, uxn_screen.width - 1);
33+ int y = clamp((e->y - PAD), 0, uxn_screen.height - 1);
34 mouse_pos(u, &u->dev[0x90], x, y);
35 } break;
36 }
37@@ -211,7 +207,7 @@ emu_run(Uxn *u, char *rom)
38 Atom wmDelete;
39 static Visual *visual;
40 visual = DefaultVisual(display, 0);
41- window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width * SCALE + PAD * 2, uxn_screen.height * SCALE + PAD * 2, 1, 0, 0);
42+ window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width + PAD * 2, uxn_screen.height + PAD * 2, 1, 0, 0);
43 if(visual->class != TrueColor)
44 return system_error("init", "True-color visual failed");
45 XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask);
46@@ -219,7 +215,7 @@ emu_run(Uxn *u, char *rom)
47 XSetWMProtocols(display, window, &wmDelete, 1);
48 XStoreName(display, window, rom);
49 XMapWindow(display, window);
50- ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width * SCALE, uxn_screen.height * SCALE, 32, 0);
51+ ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width, uxn_screen.height, 32, 0);
52 hide_cursor();
53
54 /* timer */