micromenu/src/gfx/font.cpp
2018-11-02 09:27:20 +01:00

31 lines
No EOL
649 B
C++

//
// Created by jedi on 11/1/18.
//
#include "gfx/font.h"
#include "gfx/canvas.h"
font::font(raw_font& raw ):raw_data_(raw){
}
void font::print(int x, int y, char l, canvas& c) {
int j = (l - ' ') % 32;
for (int x_ = 0; x_ < 4; x_++)
for (int y_ = 0; y_ < 5; y_++)
if (raw_data_[j][x_ + 4 * y_])
c.draw(x + x_, y + y_);
}
void font::print(int x, int y, char* str, canvas& c) {
for (int i = 0; str[i]; i++) {
print(x + i * 5,y,str[i],c);
}
}
void font::print(int x, int y, const char* str, canvas& c) {
for (int i = 0; str[i]; i++) {
print(x + i * 5,y,str[i],c);
}
}