Move src/modules/main -> src/kernel

This commit is contained in:
Justin C. Miller
2018-04-17 09:44:40 -07:00
parent 504de44ff3
commit 2050b89334
20 changed files with 26 additions and 14 deletions

35
src/kernel/font.h Normal file
View File

@@ -0,0 +1,35 @@
#pragma once
#include <stdint.h>
#include "screen.h"
#include "util.h"
class font
{
public:
static font load(void const *data);
font(const font &other);
unsigned glyph_bytes() const { return m_size.y * ((m_size.x + 7) / 8); }
unsigned count() const { return m_count; }
unsigned width() const { return m_size.x; }
unsigned height() const { return m_size.y; }
bool valid() const { return m_count > 0; }
void draw_glyph(
screen &s,
uint32_t glyph,
screen::pixel_t fg,
screen::pixel_t bg,
unsigned x,
unsigned y) const;
private:
font();
font(unsigned height, unsigned width, unsigned count, uint8_t const *data);
coord<unsigned> m_size;
unsigned m_count;
uint8_t const *m_data;
};