pokemon/font.cpp
Zack Buhman 4909a1f089 types: add type name strings
This also parses, generates, and displays nidoran male/female name
strings correctly.
2023-08-04 05:26:23 +00:00

56 lines
1.5 KiB
C++

#include "font.hpp"
#include "vram.hpp"
#include "start_size.hpp"
#include "res/font.2bpp.h"
#include "font.hpp"
#include "control.hpp"
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 0x4f;
case '!': return 0x1a;
case '(': return 0x1b;
case ')': return 0x1c;
case ',': return 0x1d;
case '-': return 0x1e;
case '.': return 0x1f;
case '/': return 0x3a;
case ':': return 0x3b;
case ';': return 0x3c;
case '?': return 0x3d;
case '[': return 0x3e;
case ']': return 0x3f;
case '`': return 0x5c; // ‘
case '\'':return 0x5d; // ’
case '^': return 0x5e; // “
case '"': return 0x5f; // ”
case extended_t::e: return 0x4a; // é
case extended_t::ellipsis: return 0x65; // …
case extended_t::pk: return 0x72; // ᴾₖ
case extended_t::mn: return 0x73; // ᴹₙ
case extended_t::jpy: return 0x78; // ¥
case extended_t::times: return 0x79; // ×
case extended_t::male: return 0x7a; //
case extended_t::female: return 0x7b; //
default: return 0x7e; // "invalid" character
}
}
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);
}