Do not re-set window size when unchanged
This commit is contained in:
parent
4db53c1cc6
commit
29e664c6b8
|
@ -86,6 +86,8 @@ screen_resize(Uint16 width, Uint16 height)
|
|||
Uint32 *pixels = NULL;
|
||||
if(width < 0x8 || height < 0x8 || width >= 0x400 || height >= 0x400)
|
||||
return;
|
||||
if(uxn_screen.width == width && uxn_screen.height == height)
|
||||
return;
|
||||
bg = malloc(width * height),
|
||||
fg = malloc(width * height);
|
||||
if(bg && fg)
|
||||
|
@ -123,8 +125,7 @@ screen_redraw(void)
|
|||
i = x + y * w;
|
||||
pixels[i] = palette[fg[i] << 2 | bg[i]];
|
||||
}
|
||||
uxn_screen.x1 = uxn_screen.y1 = 0xffff;
|
||||
uxn_screen.x2 = uxn_screen.y2 = 0;
|
||||
uxn_screen.x1 = uxn_screen.y1 = uxn_screen.x2 = uxn_screen.y2 = 0;
|
||||
}
|
||||
|
||||
Uint8
|
||||
|
|
10
src/uxnemu.c
10
src/uxnemu.c
|
@ -61,12 +61,6 @@ static Uint64 exec_deadline, deadline_interval, ms_interval;
|
|||
|
||||
char *rom_path;
|
||||
|
||||
static int
|
||||
clamp(int val, int min, int max)
|
||||
{
|
||||
return (val >= min) ? (val <= max) ? val : max : min;
|
||||
}
|
||||
|
||||
static Uint8
|
||||
audio_dei(int instance, Uint8 *d, Uint8 port)
|
||||
{
|
||||
|
@ -199,7 +193,7 @@ redraw(void)
|
|||
screen_redraw();
|
||||
if(SDL_UpdateTexture(emu_texture, NULL, uxn_screen.pixels, uxn_screen.width * sizeof(Uint32)) != 0)
|
||||
system_error("SDL_UpdateTexture", SDL_GetError());
|
||||
SDL_RenderCopy(emu_renderer, emu_texture, NULL, &emu_frame);
|
||||
SDL_RenderCopy(emu_renderer, emu_texture, NULL, NULL);
|
||||
SDL_RenderPresent(emu_renderer);
|
||||
}
|
||||
|
||||
|
@ -388,7 +382,7 @@ handle_events(Uxn *u)
|
|||
uxn_eval(u, PEEK2(&u->dev[0x30 + 0x10 * (event.type - audio0_event)]));
|
||||
/* Mouse */
|
||||
else if(event.type == SDL_MOUSEMOTION)
|
||||
mouse_pos(u, &u->dev[0x90], clamp(event.motion.x, 0, uxn_screen.width - 1), clamp(event.motion.y, 0, uxn_screen.height - 1));
|
||||
mouse_pos(u, &u->dev[0x90], event.motion.x, event.motion.y);
|
||||
else if(event.type == SDL_MOUSEBUTTONUP)
|
||||
mouse_up(u, &u->dev[0x90], SDL_BUTTON(event.button.button));
|
||||
else if(event.type == SDL_MOUSEBUTTONDOWN)
|
||||
|
|
Loading…
Reference in New Issue