Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3527b6ac4d |
@@ -180,8 +180,6 @@ void gfx_con_setpos(u32 x, u32 y)
|
|||||||
gfx_con.y = YLEFT - x;
|
gfx_con.y = YLEFT - x;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 YLeftConfig = YLEFT;
|
|
||||||
|
|
||||||
void gfx_putc(char c)
|
void gfx_putc(char c)
|
||||||
{
|
{
|
||||||
// Duplicate code for performance reasons.
|
// Duplicate code for performance reasons.
|
||||||
@@ -233,13 +231,13 @@ void gfx_putc(char c)
|
|||||||
*/
|
*/
|
||||||
gfx_con.y -= 16;
|
gfx_con.y -= 16;
|
||||||
if (gfx_con.y < 16){
|
if (gfx_con.y < 16){
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
gfx_con.x += 16;
|
gfx_con.x += 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
gfx_con.x += 16;
|
gfx_con.x += 16;
|
||||||
if (gfx_con.x > gfx_ctxt.width - 16)
|
if (gfx_con.x > gfx_ctxt.width - 16)
|
||||||
gfx_con.x = 0;
|
gfx_con.x = 0;
|
||||||
@@ -249,7 +247,7 @@ void gfx_putc(char c)
|
|||||||
else if (c == '\a')
|
else if (c == '\a')
|
||||||
gfx_con.y = 639;
|
gfx_con.y = 639;
|
||||||
else if (c == '\r')
|
else if (c == '\r')
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
@@ -275,14 +273,14 @@ void gfx_putc(char c)
|
|||||||
|
|
||||||
gfx_con.y -= 8;
|
gfx_con.y -= 8;
|
||||||
if (gfx_con.y < 8){
|
if (gfx_con.y < 8){
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
gfx_con.x += 8;
|
gfx_con.x += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (c == '\n')
|
else if (c == '\n')
|
||||||
{
|
{
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
gfx_con.x += 8;
|
gfx_con.x += 8;
|
||||||
if (gfx_con.x > gfx_ctxt.width - 8)
|
if (gfx_con.x > gfx_ctxt.width - 8)
|
||||||
gfx_con.x = 0;
|
gfx_con.x = 0;
|
||||||
@@ -292,7 +290,7 @@ void gfx_putc(char c)
|
|||||||
else if (c == '\a')
|
else if (c == '\a')
|
||||||
gfx_con.y = 639;
|
gfx_con.y = 639;
|
||||||
else if (c == '\r')
|
else if (c == '\r')
|
||||||
gfx_con.y = YLeftConfig;
|
gfx_con.y = YLEFT;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -307,46 +305,6 @@ void gfx_puts(const char *s)
|
|||||||
gfx_putc(*s);
|
gfx_putc(*s);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 _strLenLimit(const char *s, u32 limit){
|
|
||||||
u32 len = 0;
|
|
||||||
|
|
||||||
for (; *s; s++){
|
|
||||||
len++;
|
|
||||||
if (len >= limit)
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gfx_puts_limit(const char *s, u32 limit)
|
|
||||||
{
|
|
||||||
if (!s || gfx_con.mute)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < limit; i++){
|
|
||||||
if (i == limit - 3){
|
|
||||||
if (_strLenLimit(&s[i], 4) >= 4){
|
|
||||||
gfx_puts("...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gfx_putc(s[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (u32 i = 0; *s && i < limit; s++, i++){
|
|
||||||
if (i == limit - 3){
|
|
||||||
if (!(!(*s) || !(*(s + 1)) || !(*(s + 2)))){
|
|
||||||
gfx_puts("...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gfx_putc(*s);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _gfx_putn(u32 v, int base, char fill, int fcnt)
|
static void _gfx_putn(u32 v, int base, char fill, int fcnt)
|
||||||
{
|
{
|
||||||
char buf[65];
|
char buf[65];
|
||||||
@@ -423,11 +381,6 @@ void gfx_vprintf(const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
switch(*fmt)
|
switch(*fmt)
|
||||||
{
|
{
|
||||||
case 'b':;
|
|
||||||
u32 begin = YLEFT - va_arg(ap, u32);
|
|
||||||
YLeftConfig = begin;
|
|
||||||
gfx_con.y = begin;
|
|
||||||
break;
|
|
||||||
case 'c':
|
case 'c':
|
||||||
gfx_putc(va_arg(ap, u32));
|
gfx_putc(va_arg(ap, u32));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ void gfx_set_rect_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 po
|
|||||||
void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y);
|
void gfx_render_bmp_argb(const u32 *buf, u32 size_x, u32 size_y, u32 pos_x, u32 pos_y);
|
||||||
void gfx_box(int x0, int y0, int x1, int y1, u32 color);
|
void gfx_box(int x0, int y0, int x1, int y1, u32 color);
|
||||||
void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade);
|
void gfx_boxGrey(int x0, int y0, int x1, int y1, u8 shade);
|
||||||
void gfx_puts_limit(const char *s, u32 limit);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define GFX_SETPOSCORRECTED(x, y) gfx_con_setpos(y - YLEFT, x)
|
#define GFX_SETPOSCORRECTED(x, y) gfx_con_setpos(y - YLEFT, x)
|
||||||
|
|||||||
Reference in New Issue
Block a user