Housekeeping
This commit is contained in:
parent
2dff2178ed
commit
12cb8e2b1a
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
@on-mouse ( -> )
|
@on-mouse ( -> )
|
||||||
( | clear background )
|
( | clear background )
|
||||||
( #0000 DUP2 .Screen/x DEO2
|
#0000 DUP2 .Screen/x DEO2
|
||||||
.Screen/y DEO2
|
.Screen/y DEO2
|
||||||
#80 .Screen/pixel DEO )
|
#80 .Screen/pixel DEO
|
||||||
<draw-guide>
|
<draw-guide>
|
||||||
( | cursor )
|
( | cursor )
|
||||||
#41 ;cursor-icn <update-cursor>
|
#41 ;cursor-icn <update-cursor>
|
||||||
|
|
|
@ -34,7 +34,6 @@ twos(Uint16 value)
|
||||||
return (int)value;
|
return (int)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
|
screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int fx, int fy)
|
||||||
{
|
{
|
||||||
|
@ -88,7 +87,7 @@ screen_changed(void)
|
||||||
uxn_screen.y2 = 0;
|
uxn_screen.y2 = 0;
|
||||||
else if(uxn_screen.y2 >= uxn_screen.height)
|
else if(uxn_screen.y2 >= uxn_screen.height)
|
||||||
uxn_screen.y2 = uxn_screen.height;
|
uxn_screen.y2 = uxn_screen.height;
|
||||||
return uxn_screen.x2 > uxn_screen.x1 || uxn_screen.y2 > uxn_screen.y1;
|
return uxn_screen.x2 > uxn_screen.x1 && uxn_screen.y2 > uxn_screen.y1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -99,24 +98,6 @@ screen_change(int x1, int y1, int x2, int y2)
|
||||||
if(x2 > uxn_screen.x2) uxn_screen.x2 = x2;
|
if(x2 > uxn_screen.x2) uxn_screen.x2 = x2;
|
||||||
if(y2 > uxn_screen.y2) uxn_screen.y2 = y2;
|
if(y2 > uxn_screen.y2) uxn_screen.y2 = y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
screen_fill(Uint8 *layer, int color)
|
|
||||||
{
|
|
||||||
int i, length = uxn_screen.width * uxn_screen.height;
|
|
||||||
for(i = 0; i < length; i++)
|
|
||||||
layer[i] = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
|
|
||||||
{
|
|
||||||
int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
|
|
||||||
for(y = y1; y < y2 && y < h; y++)
|
|
||||||
for(x = x1, row = y * w; x < x2 && x < w; x++)
|
|
||||||
layer[x + row] = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|
||||||
static Uint8 icons[] = {
|
static Uint8 icons[] = {
|
||||||
|
@ -165,6 +146,23 @@ screen_debugger(Uxn *u)
|
||||||
draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
|
draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
screen_fill(Uint8 *layer, int color)
|
||||||
|
{
|
||||||
|
int i, length = uxn_screen.width * uxn_screen.height;
|
||||||
|
for(i = 0; i < length; i++)
|
||||||
|
layer[i] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color)
|
||||||
|
{
|
||||||
|
int row, x, y, w = uxn_screen.width, h = uxn_screen.height;
|
||||||
|
for(y = y1; y < y2 && y < h; y++)
|
||||||
|
for(x = x1, row = y * w; x < x2 && x < w; x++)
|
||||||
|
layer[x + row] = color;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
screen_palette(Uint8 *addr)
|
screen_palette(Uint8 *addr)
|
||||||
{
|
{
|
||||||
|
@ -190,7 +188,6 @@ screen_resize(Uint16 width, Uint16 height, int scale)
|
||||||
return;
|
return;
|
||||||
if(uxn_screen.width == width && uxn_screen.height == height && uxn_screen.scale == scale)
|
if(uxn_screen.width == width && uxn_screen.height == height && uxn_screen.scale == scale)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(dim_change) {
|
if(dim_change) {
|
||||||
bg = malloc(width * height), fg = malloc(width * height);
|
bg = malloc(width * height), fg = malloc(width * height);
|
||||||
if(bg && fg)
|
if(bg && fg)
|
||||||
|
@ -206,7 +203,6 @@ screen_resize(Uint16 width, Uint16 height, int scale)
|
||||||
if(!pixels)
|
if(!pixels)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uxn_screen.bg = bg, uxn_screen.fg = fg;
|
uxn_screen.bg = bg, uxn_screen.fg = fg;
|
||||||
uxn_screen.pixels = pixels;
|
uxn_screen.pixels = pixels;
|
||||||
uxn_screen.width = width, uxn_screen.height = height, uxn_screen.scale = scale;
|
uxn_screen.width = width, uxn_screen.height = height, uxn_screen.scale = scale;
|
||||||
|
@ -326,14 +322,14 @@ screen_deo(Uint8 *ram, Uint8 *d, Uint8 port)
|
||||||
for(i = 0; i <= rML; i++, rA += addr_incr)
|
for(i = 0; i <= rML; i++, rA += addr_incr)
|
||||||
screen_1bpp(layer, &ram[rA], rX + dyx * i, rY + dxy * i, color, fx, fy);
|
screen_1bpp(layer, &ram[rA], rX + dyx * i, rY + dxy * i, color, fx, fy);
|
||||||
if(fx == -1)
|
if(fx == -1)
|
||||||
x1 = rX + dyx * rML, x2 = rX + 8;
|
x1 = rX + dyx * rML, x2 = rX;
|
||||||
else
|
else
|
||||||
x1 = rX, x2 = rX + dyx * rML + 8;
|
x1 = rX, x2 = rX + dyx * rML;
|
||||||
if(fy == -1)
|
if(fy == -1)
|
||||||
y1 = rY + dxy * rML, y2 = rY + 8;
|
y1 = rY + dxy * rML, y2 = rY;
|
||||||
else
|
else
|
||||||
y1 = rY, y2 = rY + dxy * rML + 8;
|
y1 = rY, y2 = rY + dxy * rML;
|
||||||
screen_change(x1, y1, x2, y2);
|
screen_change(x1, y1, x2 + 8, y2 + 8);
|
||||||
if(rMX) rX += rDX * fx;
|
if(rMX) rX += rDX * fx;
|
||||||
if(rMY) rY += rDY * fy;
|
if(rMY) rY += rDY * fy;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -22,12 +22,11 @@ typedef struct UxnScreen {
|
||||||
extern UxnScreen uxn_screen;
|
extern UxnScreen uxn_screen;
|
||||||
extern int emu_resize(int width, int height);
|
extern int emu_resize(int width, int height);
|
||||||
int screen_changed(void);
|
int screen_changed(void);
|
||||||
void normalize_rect(void);
|
void screen_change(int x1, int y1, int x2, int y2);
|
||||||
void screen_fill(Uint8 *layer, int color);
|
void screen_fill(Uint8 *layer, int color);
|
||||||
void screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color);
|
void screen_rect(Uint8 *layer, Uint16 x1, Uint16 y1, Uint16 x2, Uint16 y2, int color);
|
||||||
void screen_palette(Uint8 *addr);
|
void screen_palette(Uint8 *addr);
|
||||||
void screen_resize(Uint16 width, Uint16 height, int scale);
|
void screen_resize(Uint16 width, Uint16 height, int scale);
|
||||||
void screen_change(int x1, int y1, int x2, int y2);
|
|
||||||
void screen_redraw(Uxn *u);
|
void screen_redraw(Uxn *u);
|
||||||
|
|
||||||
Uint8 screen_dei(Uxn *u, Uint8 addr);
|
Uint8 screen_dei(Uxn *u, Uint8 addr);
|
||||||
|
|
Loading…
Reference in New Issue