Renamed zoom for scale
This commit is contained in:
parent
6785c30587
commit
f181416095
|
@ -75,7 +75,7 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height)
|
|||
return;
|
||||
bg = realloc(p->bg.pixels, width * height),
|
||||
fg = realloc(p->fg.pixels, width * height);
|
||||
pixels = realloc(p->pixels, width * height * sizeof(Uint32) * ZOOM * ZOOM);
|
||||
pixels = realloc(p->pixels, width * height * sizeof(Uint32) * SCALE * SCALE);
|
||||
if(!bg || !fg || !pixels)
|
||||
return;
|
||||
p->bg.pixels = bg;
|
||||
|
@ -91,12 +91,12 @@ void
|
|||
screen_redraw(UxnScreen *p)
|
||||
{
|
||||
Uint8 *fg = p->fg.pixels, *bg = p->bg.pixels;
|
||||
Uint32 i, j, x, y, w = p->width * ZOOM, h = p->height * ZOOM, palette[16], *pixels = p->pixels;
|
||||
Uint32 i, j, x, y, w = p->width * SCALE, h = p->height * SCALE, palette[16], *pixels = p->pixels;
|
||||
for(i = 0; i < 16; i++)
|
||||
palette[i] = p->palette[(i >> 2) ? (i >> 2) : (i & 3)];
|
||||
for(y = 0; y < h; y++)
|
||||
for(x = 0; x < w; x++) {
|
||||
j = ((x / ZOOM) + (y / ZOOM) * p->width);
|
||||
j = ((x / SCALE) + (y / SCALE) * p->width);
|
||||
pixels[x + y * w] = palette[fg[j] << 2 | bg[j]];
|
||||
}
|
||||
p->fg.changed = p->bg.changed = 0;
|
||||
|
|
|
@ -10,7 +10,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
WITH REGARD TO THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define ZOOM 2
|
||||
#define SCALE 2
|
||||
|
||||
typedef struct Layer {
|
||||
Uint8 *pixels, changed;
|
||||
|
|
|
@ -72,7 +72,7 @@ static void
|
|||
emu_draw(void)
|
||||
{
|
||||
screen_redraw(&uxn_screen);
|
||||
XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * ZOOM, uxn_screen.height * ZOOM);
|
||||
XPutImage(display, window, DefaultGC(display, 0), ximage, 0, 0, PAD, PAD, uxn_screen.width * SCALE, uxn_screen.height * SCALE);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -166,7 +166,7 @@ emu_event(Uxn *u)
|
|||
} break;
|
||||
case MotionNotify: {
|
||||
XMotionEvent *e = (XMotionEvent *)&ev;
|
||||
mouse_pos(u, &u->dev[0x90], (e->x - PAD) / ZOOM, (e->y - PAD) / ZOOM);
|
||||
mouse_pos(u, &u->dev[0x90], (e->x - PAD) / SCALE, (e->y - PAD) / SCALE);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,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 * ZOOM + PAD * 2, uxn_screen.height * ZOOM + PAD * 2, 1, 0, 0);
|
||||
window = XCreateSimpleWindow(display, RootWindow(display, 0), 0, 0, uxn_screen.width * SCALE + PAD * 2, uxn_screen.height * SCALE + PAD * 2, 1, 0, 0);
|
||||
if(visual->class != TrueColor)
|
||||
return system_error("init", "True-color visual failed");
|
||||
XSelectInput(display, window, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ExposureMask | KeyPressMask | KeyReleaseMask);
|
||||
|
@ -185,7 +185,7 @@ display_start(char *title)
|
|||
XSetWMProtocols(display, window, &wmDelete, 1);
|
||||
XStoreName(display, window, title);
|
||||
XMapWindow(display, window);
|
||||
ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width * ZOOM, uxn_screen.height * ZOOM, 32, 0);
|
||||
ximage = XCreateImage(display, visual, DefaultDepth(display, DefaultScreen(display)), ZPixmap, 0, (char *)uxn_screen.pixels, uxn_screen.width * SCALE, uxn_screen.height * SCALE, 32, 0);
|
||||
hide_cursor();
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue