diff options
Diffstat (limited to 'src/kernel/graphics')
-rw-r--r-- | src/kernel/graphics/font.h | 22 | ||||
-rw-r--r-- | src/kernel/graphics/vesa.c | 21 |
2 files changed, 38 insertions, 5 deletions
diff --git a/src/kernel/graphics/font.h b/src/kernel/graphics/font.h index 7a110e1..bcf0b30 100644 --- a/src/kernel/graphics/font.h +++ b/src/kernel/graphics/font.h @@ -7,6 +7,28 @@ #include <stdint.h> +uint16_t cursor[19] = { + 0b100000000000, + 0b110000000000, + 0b111000000000, + 0b111100000000, + 0b111110000000, + 0b111111000000, + 0b111111100000, + 0b111111110000, + 0b111111111000, + 0b111111111100, + 0b111111111110, + 0b111111111111, + 0b111111111111, + 0b111111110000, + 0b111101111000, + 0b111001111000, + 0b110000111100, + 0b000000111100, + 0b000000011000 +}; + uint8_t font_16[758][16] = { // 32 $20 'SPACE' // width 8, bbx 0, bby -4, bbw 8, bbh 16 diff --git a/src/kernel/graphics/vesa.c b/src/kernel/graphics/vesa.c index eb70583..f72f4ab 100644 --- a/src/kernel/graphics/vesa.c +++ b/src/kernel/graphics/vesa.c @@ -342,11 +342,22 @@ void vesa_draw_number(int n) { } void vesa_draw_cursor(int x, int y) { - if (x < 0) x = 0; - if (y < 0) y = 0; - if (x > vbe_width - 1) x = vbe_width - 1; - if (y > vbe_height - 1) y = vbe_height - 1; - vesa_draw_rectangle(x, y, x + font_width, y + font_height, terminal_color); + int pos = x * vbe_bpl + y * vbe_pitch; + char *draw = (char *) &fb[pos]; + for (int cy = 0; cy <= 19; cy++) { + for (int cx = 0; cx <= 12 + 1; cx++) { + if (cursor[cy] & ((1 << 12) >> cx)) { + draw[vbe_bpl * cx] = terminal_color[2]; + draw[vbe_bpl * cx + 1] = terminal_color[1]; + draw[vbe_bpl * cx + 2] = terminal_color[0]; + } else { + draw[vbe_bpl * cx] = terminal_background[2]; + draw[vbe_bpl * cx + 1] = terminal_background[1]; + draw[vbe_bpl * cx + 2] = terminal_background[0]; + } + } + draw += vbe_pitch; + } } void vesa_set_color(uint32_t color) { |