[Teton] Factor drawing glyphs to screen into a separate class.

This commit is contained in:
Drew Galbraith 2023-11-21 19:32:31 -08:00
parent fe44804dd9
commit afdb024c36
6 changed files with 60 additions and 7 deletions

View file

@ -0,0 +1,23 @@
#pragma once
#include <glacier/string/string_view.h>
#include "framebuffer/framebuffer.h"
#include "framebuffer/psf.h"
class Console {
public:
explicit Console(Framebuffer& fb, Psf& psf) : framebuf_(fb), psf_(psf) {}
void WriteChar(char c);
void WriteString(glcr::StringView str);
uint32_t rows() { return framebuf_.height() / (psf_.height() + 1); }
uint32_t cols() { return framebuf_.width() / (psf_.width() + 1); }
private:
// TODO: Don't store a reference here.
Framebuffer& framebuf_;
Psf& psf_;
uint64_t cursor_pos_ = 0;
};