Integrate all the progress into master #6
|
@ -39,6 +39,36 @@ namespace JabyEngine {
|
|||
using namespace JabyEngine::GPU;
|
||||
|
||||
namespace SJIS {
|
||||
struct FontBuffer {
|
||||
static constexpr auto FontSize = SizeU16::create(16, 16);
|
||||
static constexpr auto AmountOfChars = 4;
|
||||
|
||||
struct Line {
|
||||
Color pixel[FontSize.width];
|
||||
|
||||
void load(uint16_t bit_pattern) {
|
||||
size_t px_idx = 0;
|
||||
for(uint16_t shift = 1 << 15; shift; shift = shift >> 1) {
|
||||
this->pixel[px_idx++] = bit_pattern & shift ? Color::from_rgb(0xFF, 0xFF, 0xFF) : Color::from_rgb(0x0, 0x0, 0x0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct Row {
|
||||
Line character[AmountOfChars];
|
||||
};
|
||||
|
||||
Row rows[FontSize.height];
|
||||
|
||||
void load_char(int32_t chr_idx, const uint16_t* bit_map) {
|
||||
for(auto& cur_row : this->rows) {
|
||||
auto& cur_line = cur_row.character[chr_idx];
|
||||
|
||||
cur_line.load(__builtin_bswap16(*bit_map++));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct SpecialChar {
|
||||
uint8_t base_offset;
|
||||
uint8_t tile_id;
|
||||
|
@ -70,17 +100,17 @@ namespace JabyEngine {
|
|||
static const auto LowerCaseLetter = RangeChar{{0x81, 64}, 26};
|
||||
|
||||
void load() {
|
||||
alignas(uint32_t) Color test[16*16];
|
||||
FontBuffer buffer;
|
||||
|
||||
for(auto& color : test) {
|
||||
color = Color::from_rgb(0, 0xFF, 0xFF);
|
||||
for(size_t n = 0; n < 4; n++) {
|
||||
buffer.load_char(n, SysCall::Krom2RawAdd(0x8200 | (UpperCaseLetter.start_char.base_offset + n)));
|
||||
}
|
||||
|
||||
GPU::internal::DMA::Receive::prepare();
|
||||
GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16, 16));
|
||||
GPU::internal::DMA::Receive::set_src(reinterpret_cast<const uintptr_t>(test));
|
||||
GPU::internal::DMA::Receive::set_dst(PositionU16::create(0, 0), SizeU16::create(16*4, 16));
|
||||
GPU::internal::DMA::Receive::set_src(reinterpret_cast<const uintptr_t>(&buffer.rows));
|
||||
printf("Sending...\n");
|
||||
GPU::internal::DMA::Receive::start(sizeof(test)/4/16);
|
||||
GPU::internal::DMA::Receive::start(sizeof(buffer)/4/16);
|
||||
GPU::internal::DMA::wait();
|
||||
GPU::internal::DMA::end();
|
||||
printf("Done!\n");
|
||||
|
|
Loading…
Reference in New Issue