uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 8a32555893814e34c091eb4a4cd0ce94880c462d
parent 28cfb143ca8a20a77a8f245a24ccd4bf7bc1cb70
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat, 18 Sep 2021 17:10:29 -0700

Clear before resizing

Diffstat:
Msrc/uxnemu.c | 13+++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -296,8 +296,13 @@ update_palette(Uint8 *addr) } void -set_size(Uxn *u, Uint16 width, Uint16 height) +set_size(Uint16 width, Uint16 height) { + int i; + /* clear */ + for(i = 0; i < ppu.height * ppu.width; ++i) + ppu_screen[i] = palette[0]; + /* resize */ ppu_resize(&ppu, width / 8, height / 8); gRect.w = ppu.width; gRect.h = ppu.height; @@ -307,7 +312,7 @@ set_size(Uxn *u, Uint16 width, Uint16 height) SDL_RenderSetLogicalSize(gRenderer, ppu.width + PAD * 2, ppu.height + PAD * 2); gTexture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ppu.width + PAD * 2, ppu.height + PAD * 2); SDL_SetWindowSize(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom); - redraw(u); + reqdraw = 1; } #pragma mark - Devices @@ -346,9 +351,9 @@ screen_talk(Device *d, Uint8 b0, Uint8 w) if(!w) return 1; if(b0 == 0x3) - set_size(d->u, peek16(d->dat, 0x2), ppu.height); + set_size(peek16(d->dat, 0x2), ppu.height); else if(b0 == 0x5) - set_size(d->u, ppu.width, peek16(d->dat, 0x4)); + set_size(ppu.width, peek16(d->dat, 0x4)); else if(b0 == 0xe) { Uint16 x = peek16(d->dat, 0x8); Uint16 y = peek16(d->dat, 0xa);