pokemon/font.cpp
Zack Buhman 0b61a59117 font: initial
the fonts are loaded, but nothing is drawn.
2023-07-29 06:38:45 +00:00

41 lines
869 B
C++

#include "font.hpp"
#include "vram.hpp"
#include "start_size.hpp"
#include "res/font.2bpp.h"
#include "font.hpp"
constexpr inline uint8_t ascii_to_font(uint8_t c)
{
if (c >= 'A' && c <= 'Z')
return (c - 'A') + 0;
if (c >= 'a' && c <= 'z')
return (c - 'a') + 32;
if (c >= '0' && c <= '9')
return (c - '0') + 64;
switch (c) {
case '!': return 26;
case '(': return 27;
case ')': return 28;
case ',': return 29;
case '-': return 30;
case '.': return 31;
case '/': return 58;
case ':': return 59;
case ';': return 60;
case '?': return 61;
case '[': return 62;
case ']': return 63;
}
}
uint32_t load_font(uint32_t top)
{
static start_size_t start_size = {
reinterpret_cast<uint8_t*>(&_binary_res_font_2bpp_start),
reinterpret_cast<uint32_t>(&_binary_res_font_2bpp_size),
};
return cell_data(start_size, top);
}