Clear on resize
This commit is contained in:
parent
8a32555893
commit
a5201767d7
|
@ -54,9 +54,6 @@
|
||||||
;on-mouse .Mouse/vector DEO2
|
;on-mouse .Mouse/vector DEO2
|
||||||
;on-message .Console/vector DEO2
|
;on-message .Console/vector DEO2
|
||||||
|
|
||||||
#0160 .Screen/width DEO2
|
|
||||||
#0100 .Screen/height DEO2
|
|
||||||
|
|
||||||
( find center )
|
( find center )
|
||||||
.Screen/width DEI2 2// .center/x STZ2
|
.Screen/width DEI2 2// .center/x STZ2
|
||||||
.Screen/height DEI2 2// .center/y STZ2
|
.Screen/height DEI2 2// .center/y STZ2
|
||||||
|
|
|
@ -19,6 +19,18 @@ static Uint8 blending[5][16] = {
|
||||||
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2},
|
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2},
|
||||||
{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}};
|
{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}};
|
||||||
|
|
||||||
|
static void
|
||||||
|
ppu_clear(Ppu *p)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
for(y = 0; y < p->height; ++y) {
|
||||||
|
for(x = 0; x < p->width; ++x) {
|
||||||
|
ppu_pixel(p, p->bg, x, y, 0);
|
||||||
|
ppu_pixel(p, p->fg, x, y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ppu_pixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color)
|
ppu_pixel(Ppu *p, Uint8 *layer, Uint16 x, Uint16 y, Uint8 color)
|
||||||
{
|
{
|
||||||
|
@ -78,15 +90,18 @@ ppu_init(Ppu *p, Uint8 hor, Uint8 ver)
|
||||||
p->height = 8 * ver;
|
p->height = 8 * ver;
|
||||||
p->bg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
|
p->bg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
|
||||||
p->fg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
|
p->fg = calloc(1, p->width / 4 * p->height * sizeof(Uint8));
|
||||||
|
ppu_clear(p);
|
||||||
return p->bg && p->fg;
|
return p->bg && p->fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ppu_resize(Ppu *p, Uint8 hor, Uint8 ver)
|
ppu_resize(Ppu *p, Uint8 hor, Uint8 ver)
|
||||||
{
|
{
|
||||||
|
ppu_clear(p);
|
||||||
p->width = 8 * hor;
|
p->width = 8 * hor;
|
||||||
p->height = 8 * ver;
|
p->height = 8 * ver;
|
||||||
p->bg = realloc(p->bg, p->width / 4 * p->height * sizeof(Uint8));
|
p->bg = realloc(p->bg, p->width / 4 * p->height * sizeof(Uint8));
|
||||||
p->fg = realloc(p->fg, p->width / 4 * p->height * sizeof(Uint8));
|
p->fg = realloc(p->fg, p->width / 4 * p->height * sizeof(Uint8));
|
||||||
|
ppu_clear(p);
|
||||||
return p->bg && p->fg;
|
return p->bg && p->fg;
|
||||||
}
|
}
|
|
@ -298,11 +298,6 @@ update_palette(Uint8 *addr)
|
||||||
void
|
void
|
||||||
set_size(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);
|
ppu_resize(&ppu, width / 8, height / 8);
|
||||||
gRect.w = ppu.width;
|
gRect.w = ppu.width;
|
||||||
gRect.h = ppu.height;
|
gRect.h = ppu.height;
|
||||||
|
|
Loading…
Reference in New Issue