Add errors

and prepare for file menu more
and fix that you can't go left right when going up down
This commit is contained in:
SuchMemeManySkill
2020-12-25 00:20:30 +01:00
parent b97bab3661
commit 1a931b0256
16 changed files with 167 additions and 30 deletions

View File

@@ -123,6 +123,8 @@ static const u8 _gfx_font[] = {
0x00, 0x0E, 0x12, 0x22, 0x22, 0x22, 0x3E, 0x00, // Char 128 (file)
};
u32 YLeftConfig = YLEFT;
void gfx_clear_grey(u8 color)
{
memset(gfx_ctxt.fb, color, gfx_ctxt.width * gfx_ctxt.height * 4);
@@ -240,13 +242,13 @@ void gfx_putc(char c)
gfx_con.y -= 16;
if (gfx_con.y < 16){
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
gfx_con.x += 16;
}
}
else if (c == '\n')
{
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
gfx_con.x += 16;
if (gfx_con.x > gfx_ctxt.width - 16)
gfx_con.x = 0;
@@ -256,7 +258,7 @@ void gfx_putc(char c)
else if (c == '\a')
gfx_con.y = 639;
else if (c == '\r')
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
break;
case 8:
@@ -282,14 +284,14 @@ void gfx_putc(char c)
gfx_con.y -= 8;
if (gfx_con.y < 8){
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
gfx_con.x += 8;
}
}
else if (c == '\n')
{
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
gfx_con.x += 8;
if (gfx_con.x > gfx_ctxt.width - 8)
gfx_con.x = 0;
@@ -299,7 +301,7 @@ void gfx_putc(char c)
else if (c == '\a')
gfx_con.y = 639;
else if (c == '\r')
gfx_con.y = YLEFT;
gfx_con.y = YLeftConfig;
break;
}
@@ -449,6 +451,11 @@ void gfx_vprintf(const char *fmt, va_list ap)
gfx_con.bgcol = va_arg(ap, u32);
gfx_con.fillbg = 1;
break;
case 'b':;
u32 b = YLEFT - va_arg(ap, u32);
gfx_con.y = b;
YLeftConfig = gfx_con.y;
break;
case '%':
gfx_putc('%');
break;

View File

@@ -4,6 +4,7 @@
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_DEFAULT 0xFF1B1B1B
#define COLOR_GREY 0xFF888888
#define COLOR_DARKGREY 0xFF333333
#define COLORTORGB(color) (color & 0x00FFFFFF)
#define SETCOLOR(fg, bg) gfx_con_setcol(fg, 1, bg)

View File

@@ -129,7 +129,7 @@ int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 op
else if (input->b && options & ENABLEB)
return 0;
else if (input->down || input->rDown || input->right){ //Rdown should probs not trigger a page change. Same for RUp
u32 temp = (input->right) ? screenLenY : 1;
u32 temp = (input->right && !(input->down || input->rDown)) ? screenLenY : 1;
if (vec->count > selected + temp){
selected += temp;
@@ -141,7 +141,7 @@ int newMenu(Vector_t* vec, int startIndex, int screenLenX, int screenLenY, u8 op
}
}
else if (input->up || input->rUp || input->left){
u32 temp = (input->left) ? screenLenY : 1;
u32 temp = (input->left && !(input->up || input->rUp)) ? screenLenY : 1;
if (selected >= temp){
selected -= temp;
break;