summaryrefslogtreecommitdiff
path: root/src/os/object/framebuffer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/object/framebuffer.cc')
-rw-r--r--src/os/object/framebuffer.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/os/object/framebuffer.cc b/src/os/object/framebuffer.cc
index ad128dc..7b3fe0d 100644
--- a/src/os/object/framebuffer.cc
+++ b/src/os/object/framebuffer.cc
@@ -67,4 +67,33 @@ void Framebuffer::drawAt(unsigned int x, unsigned int y, unsigned int w, unsigne
}
}
+void Framebuffer::put(char c)
+{
+ if (font == 0) {
+ return;
+ }
+ if (c == '\n') {
+ fontX = 0;
+ fontY += 8;
+ return;
+ }
+ if ((c < 32) || (c > 126)) {
+ c = '?';
+ }
+ glyph_t glyph = font[c - 32];
+ const unsigned char glyph_w = glyph[0];
+
+ if (fontX + glyph_w + 1 >= width) {
+ put('\n');
+ }
+ if (fontY >= height) {
+ return;
+ }
+ for (unsigned char i = 0; i < glyph_w; i++) {
+ data[(height/8) * (fontX + i) + fontY/8] = glyph[i+1];
+ }
+ data[(height/8) * (fontX + glyph_w + 1) + fontY/8] = 0;
+ fontX += glyph_w + 2;
+}
+
Framebuffer fb(framebuffer);