holy SHIFT
This commit is contained in:
@@ -66,7 +66,19 @@ static void draw_char(char c, int px, int py, int fg, int bg)
|
||||
}
|
||||
}
|
||||
|
||||
static void putchar(char c)
|
||||
static void erase_char(int px, int py)
|
||||
{
|
||||
for (size_t y=0; y<FONT_HEIGHT; y++)
|
||||
{
|
||||
for (size_t x=0; x<8; x++)
|
||||
{
|
||||
// Black
|
||||
putpixel(px+x, py+y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void putchar(char c)
|
||||
{
|
||||
if (c == '\n')
|
||||
{
|
||||
@@ -75,6 +87,17 @@ static void putchar(char c)
|
||||
return;
|
||||
}
|
||||
|
||||
// Improperly handled.
|
||||
// When we're on an empty line it should get to the upper line's last character
|
||||
if (c == '\b')
|
||||
{
|
||||
cursor.x--;
|
||||
int px = cursor.x * FONT_WIDTH;
|
||||
int py = cursor.y * FONT_HEIGHT;
|
||||
erase_char(px, py);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cursor.x+1)*FONT_WIDTH >= framebuffer->width)
|
||||
{
|
||||
cursor.x = 0;
|
||||
@@ -87,7 +110,7 @@ static void putchar(char c)
|
||||
cursor.x++;
|
||||
}
|
||||
|
||||
// Overhead that could be avoided, right?
|
||||
// Overhead that could be avoided, right? (for printf)
|
||||
void _putchar(char character)
|
||||
{
|
||||
putchar(character);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
int term_init();
|
||||
void kputs(const char* str);
|
||||
void putchar(char c);
|
||||
|
||||
enum TermColors
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user