... | ... |
@@ -86,6 +86,8 @@ screen_resize(Uint16 width, Uint16 height) |
86 | 86 |
Uint32 *pixels = NULL; |
87 | 87 |
if(width < 0x8 || height < 0x8 || width >= 0x400 || height >= 0x400) |
88 | 88 |
return; |
89 |
+ if(uxn_screen.width == width && uxn_screen.height == height) |
|
90 |
+ return; |
|
89 | 91 |
bg = malloc(width * height), |
90 | 92 |
fg = malloc(width * height); |
91 | 93 |
if(bg && fg) |
... | ... |
@@ -123,8 +125,7 @@ screen_redraw(void) |
123 | 125 |
i = x + y * w; |
124 | 126 |
pixels[i] = palette[fg[i] << 2 | bg[i]]; |
125 | 127 |
} |
126 |
- uxn_screen.x1 = uxn_screen.y1 = 0xffff; |
|
127 |
- uxn_screen.x2 = uxn_screen.y2 = 0; |
|
128 |
+ uxn_screen.x1 = uxn_screen.y1 = uxn_screen.x2 = uxn_screen.y2 = 0; |
|
128 | 129 |
} |
129 | 130 |
|
130 | 131 |
Uint8 |
... | ... |
@@ -61,12 +61,6 @@ static Uint64 exec_deadline, deadline_interval, ms_interval; |
61 | 61 |
|
62 | 62 |
char *rom_path; |
63 | 63 |
|
64 |
-static int |
|
65 |
-clamp(int val, int min, int max) |
|
66 |
-{ |
|
67 |
- return (val >= min) ? (val <= max) ? val : max : min; |
|
68 |
-} |
|
69 |
- |
|
70 | 64 |
static Uint8 |
71 | 65 |
audio_dei(int instance, Uint8 *d, Uint8 port) |
72 | 66 |
{ |
... | ... |
@@ -199,7 +193,7 @@ redraw(void) |
199 | 193 |
screen_redraw(); |
200 | 194 |
if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0) |
201 | 195 |
system_error("SDL_UpdateTexture", SDL_GetError()); |
202 |
- SDL_RenderCopy(emu_renderer, emu_texture, NULL, &emu_frame); |
|
196 |
+ SDL_RenderCopy(emu_renderer, emu_texture, NULL, NULL); |
|
203 | 197 |
SDL_RenderPresent(emu_renderer); |
204 | 198 |
} |
205 | 199 |
|
... | ... |
@@ -216,7 +210,7 @@ init(void) |
216 | 210 |
as.userdata = NULL; |
217 | 211 |
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) |
218 | 212 |
return system_error("sdl", SDL_GetError()); |
219 |
- emu_window = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH) * zoom, (HEIGHT) * zoom, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); |
|
213 |
+ emu_window = SDL_CreateWindow("Uxn", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, (WIDTH)*zoom, (HEIGHT)*zoom, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); |
|
220 | 214 |
if(emu_window == NULL) |
221 | 215 |
return system_error("sdl_window", SDL_GetError()); |
222 | 216 |
emu_renderer = SDL_CreateRenderer(emu_window, -1, 0); |
... | ... |
@@ -388,7 +382,7 @@ handle_events(Uxn *u) |
388 | 382 |
uxn_eval(u, PEEK2(&u->dev[0x30 + 0x10 * (event.type - audio0_event)])); |
389 | 383 |
/* Mouse */ |
390 | 384 |
else if(event.type == SDL_MOUSEMOTION) |
391 |
- mouse_pos(u, &u->dev[0x90], clamp(event.motion.x, 0, uxn_screen.width - 1), clamp(event.motion.y, 0, uxn_screen.height - 1)); |
|
385 |
+ mouse_pos(u, &u->dev[0x90], event.motion.x, event.motion.y); |
|
392 | 386 |
else if(event.type == SDL_MOUSEBUTTONUP) |
393 | 387 |
mouse_up(u, &u->dev[0x90], SDL_BUTTON(event.button.button)); |
394 | 388 |
else if(event.type == SDL_MOUSEBUTTONDOWN) |