Browse code

Clear before resizing

neauoire authored on 19/09/2021 00:10:29
Showing 1 changed files
... ...
@@ -296,8 +296,13 @@ update_palette(Uint8 *addr)
296 296
 }
297 297
 
298 298
 void
299
-set_size(Uxn *u, Uint16 width, Uint16 height)
299
+set_size(Uint16 width, Uint16 height)
300 300
 {
301
+	int i;
302
+	/* clear */
303
+	for(i = 0; i < ppu.height * ppu.width; ++i)
304
+		ppu_screen[i] = palette[0];
305
+	/* resize */
301 306
 	ppu_resize(&ppu, width / 8, height / 8);
302 307
 	gRect.w = ppu.width;
303 308
 	gRect.h = ppu.height;
... ...
@@ -307,7 +312,7 @@ set_size(Uxn *u, Uint16 width, Uint16 height)
307 312
 	SDL_RenderSetLogicalSize(gRenderer, ppu.width + PAD * 2, ppu.height + PAD * 2);
308 313
 	gTexture = SDL_CreateTexture(gRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ppu.width + PAD * 2, ppu.height + PAD * 2);
309 314
 	SDL_SetWindowSize(gWindow, (ppu.width + PAD * 2) * zoom, (ppu.height + PAD * 2) * zoom);
310
-	redraw(u);
315
+	reqdraw = 1;
311 316
 }
312 317
 
313 318
 #pragma mark - Devices
... ...
@@ -346,9 +351,9 @@ screen_talk(Device *d, Uint8 b0, Uint8 w)
346 351
 	if(!w)
347 352
 		return 1;
348 353
 	if(b0 == 0x3)
349
-		set_size(d->u, peek16(d->dat, 0x2), ppu.height);
354
+		set_size(peek16(d->dat, 0x2), ppu.height);
350 355
 	else if(b0 == 0x5)
351
-		set_size(d->u, ppu.width, peek16(d->dat, 0x4));
356
+		set_size(ppu.width, peek16(d->dat, 0x4));
352 357
 	else if(b0 == 0xe) {
353 358
 		Uint16 x = peek16(d->dat, 0x8);
354 359
 		Uint16 y = peek16(d->dat, 0xa);