diff options
| author | Ada Christine <adachristine18@gmail.com> | 2023-01-30 03:44:26 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2023-01-30 03:44:26 +0000 |
| commit | 8acb41611b556959c3e5d9db8074c3b871ed3df1 (patch) | |
| tree | 3e54e51454fc32c1c4aafe0a1a0e730ecaa84a4a | |
| parent | ed4c2727a4a9721f72ef404ccf7a7df28e2cdd75 (diff) | |
can draw character
| -rw-r--r-- | kc/core/video.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kc/core/video.c b/kc/core/video.c index 94ee1f2..1eb3ce4 100644 --- a/kc/core/video.c +++ b/kc/core/video.c @@ -148,6 +148,8 @@ static const unsigned char ascii_characters[][13] = { {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00} }; +static const char ascii_test[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + struct video_color { uint8_t red; @@ -188,6 +190,7 @@ static struct video_bitmap framebuffer_bitmap; static struct console_state console_state; int pixel_put(struct video_color color, int xpos, int ypos); +int character_put(int c); int video_init(void) { @@ -220,6 +223,8 @@ int video_init(void) } } + character_put('A'); + return 0; } @@ -232,3 +237,18 @@ int pixel_put(struct video_color color, int xpos, int ypos) return 0; } +int character_put(int c) +{ + for (int i = 0; i < FONT_HEIGHT; i++) + { + for (int j = 0; j < FONT_WIDTH; j++) + { + pixel_put(ascii_characters[c - 32][i] & (1 << j) ? console_state.foreground : console_state.background, FONT_WIDTH - j, FONT_HEIGHT - i); + } + } + + console_state.cursor_column++; + + return 0; +} + |
