summaryrefslogtreecommitdiff
path: root/include/object
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-02 22:01:42 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-02 22:01:42 +0100
commitcb2e1564ec96ecea4ec08f332542415ca5a47a31 (patch)
tree2e3c2736c6652c8c11016ea0580f1866a0dc2e25 /include/object
parentdf860f2b0899779d3ca3b25d6da0e1dd06188818 (diff)
framebuffer: add OutputStream support with pixelfont
Diffstat (limited to 'include/object')
-rw-r--r--include/object/framebuffer.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/include/object/framebuffer.h b/include/object/framebuffer.h
index 6eac7e0..a76a24a 100644
--- a/include/object/framebuffer.h
+++ b/include/object/framebuffer.h
@@ -1,11 +1,20 @@
#pragma once
+#include "object/outputstream.h"
-class Framebuffer
+typedef const unsigned char* glyph_t;
+
+class Framebuffer : public OutputStream
{
+ private:
+ Framebuffer(Framebuffer& copy);
+ const glyph_t *font;
+ unsigned int fontX, fontY;
+ unsigned char scale;
+
public:
unsigned char *data;
- Framebuffer(unsigned char *data) : data(data) {}
+ Framebuffer(unsigned char *data) : font(0), fontX(0), fontY(0), scale(1), data(data) {}
constexpr static unsigned int const width = CONFIG_framebuffer_width;
constexpr static unsigned int const height = CONFIG_framebuffer_height;
@@ -13,9 +22,9 @@ class Framebuffer
void clear();
void fillBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
void drawAt(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char *image);
-
- private:
- Framebuffer(Framebuffer& copy);
+ void setFont(const glyph_t *font) { this->font = font; }
+ void setPos(unsigned int newX, unsigned int newY) { fontX = newX; fontY = newY; }
+ virtual void put(char c) override;
};
extern Framebuffer fb;