introduced proper rectangular rendering

This commit is contained in:
Luxferre
2026-01-19 13:43:02 +02:00
parent 7c2a0b24ed
commit 12a5d39c54
2 changed files with 22 additions and 12 deletions
+18
View File
@@ -38,6 +38,11 @@
#define EZJOY_SL 7
#define EZJOY_ST 8
#define EZ_CORNER_UL (char) 20
#define EZ_CORNER_UR (char) 18
#define EZ_CORNER_DL (char) 17
#define EZ_CORNER_DR (char) 8
#define NES_BLACK 0x0F
#define NES_WHITE 0x30
#define NES_RED 0x15
@@ -213,5 +218,18 @@ void delay_cycles(u16 n) {
for(i=0;i<n;++i);
}
/* Draw a proper rectangle with corners */
void rect(u8 x, u8 y, u8 w, u8 h) {
u8 bl_y = y + h - 1, tr_x = x + w - 1;
cputcxy(x, y, EZ_CORNER_UL);
chlinexy(x + 1, y, w - 2);
cputcxy(tr_x, y, EZ_CORNER_UR);
chlinexy(x + 1, bl_y, w - 2);
cvlinexy(x, y + 1, h - 2);
cputcxy(x, bl_y, EZ_CORNER_DL);
cvlinexy(tr_x, y + 1, h - 2);
cputcxy(tr_x, bl_y, EZ_CORNER_DR);
}
#endif