diff --git a/inc/drivers/graphics/renderer.h b/inc/drivers/graphics/renderer.h index 3c1fbf5..44d9be1 100644 --- a/inc/drivers/graphics/renderer.h +++ b/inc/drivers/graphics/renderer.h @@ -45,6 +45,7 @@ typedef struct { graphics_buffer_T* graphics_buffer_request (uint32_t pos_x, uint32_t pos_y, uint32_t width, uint32_t height, graphics_buffer_layer_E layer); void graphics_buffer_show (graphics_buffer_T* graphics_buffer); void graphics_buffer_hide (graphics_buffer_T* graphics_buffer); +void graphics_buffer_move (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y); void graphics_buffer_destruct (graphics_buffer_T* graphics_buffer); void graphics_buffer_shift_up (graphics_buffer_T* graphics_buffer, uint16_t shift); void graphics_buffer_set_pixel (graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y, color_argb_T color); diff --git a/inc/drivers/tty.h b/inc/drivers/tty.h index e11034d..0c23435 100644 --- a/inc/drivers/tty.h +++ b/inc/drivers/tty.h @@ -11,6 +11,7 @@ typedef struct { graphics_buffer_T* graphics_buffer; pipe_T* output; pipe_T input; + graphics_buffer_T* cursor_overlay; position_T cursor; color_argb_T color; } tty_T; diff --git a/src/drivers/graphics/renderer.c b/src/drivers/graphics/renderer.c index c0a92f4..32840af 100644 --- a/src/drivers/graphics/renderer.c +++ b/src/drivers/graphics/renderer.c @@ -39,6 +39,11 @@ void graphics_buffer_hide (graphics_buffer_T* graphics_buffer) { graphics_buffer->render = false; } +void graphics_buffer_move(graphics_buffer_T* graphics_buffer, uint32_t x, uint32_t y) { + graphics_buffer->pos_x = x; + graphics_buffer->pos_y = y; +} + void graphics_buffer_destruct(graphics_buffer_T* graphics_buffer) { if (graphics_buffer->prev != NULL) { graphics_buffer->prev->next = graphics_buffer->next; diff --git a/src/drivers/tty.c b/src/drivers/tty.c index 6ba5d99..8220a9d 100644 --- a/src/drivers/tty.c +++ b/src/drivers/tty.c @@ -9,11 +9,14 @@ tty_T* g_tty; void tty_init() { g_tty = memory_allocate(sizeof(tty_T)); g_tty->graphics_buffer = graphics_buffer_request(0, 0, graphics_renderer_get_width(), graphics_renderer_get_height(), GRAPHICS_BUFFER_STANDARD); + g_tty->cursor_overlay = graphics_buffer_request(0, 0, 8, 16, GRAPHICS_BUFFER_OVERLAY); g_tty->cursor.x = 0; g_tty->cursor.y = 0; g_tty->color = g_color_palette[COLOR_PAL_GREY_LIGHT]; g_tty->output = NULL; pipe_init(&g_tty->input, NULL, tty_update); + + graphics_buffer_draw_char(g_tty->cursor_overlay, 0, 0, g_color_palette[COLOR_PAL_GREY_DARK], '_'); } void tty_update() { @@ -25,6 +28,8 @@ void tty_update() { g_tty->cursor = graphics_buffer_draw_string(g_tty->graphics_buffer, g_tty->cursor.x, g_tty->cursor.y, g_tty->color, buffer); } + graphics_buffer_move(g_tty->cursor_overlay, g_tty->cursor.x, g_tty->cursor.y); + graphics_renderer_update(); } @@ -32,5 +37,6 @@ uint32_t tty_write(string_t string) { pipe_write(g_tty->output, string, string_length(string)); g_tty->cursor = graphics_buffer_draw_string(g_tty->graphics_buffer, g_tty->cursor.x, g_tty->cursor.y, g_tty->color, string); + graphics_buffer_move(g_tty->cursor_overlay, g_tty->cursor.x, g_tty->cursor.y); graphics_renderer_update(); } \ No newline at end of file