73 lines
2.8 KiB
C++
73 lines
2.8 KiB
C++
#include <PSX/File/Processor/cd_file_processor.hpp>
|
|
#include <PSX/AutoLBA/auto_lba_declaration.hpp>
|
|
#include <PSX/GPU/gpu.hpp>
|
|
#include <PSX/GPU/gpu_primitives.hpp>
|
|
#include <stdio.h>
|
|
|
|
enum LBA {
|
|
__jabyengine_start_lba_request
|
|
__jabyengine_request_lba_for(FONT, "ASSETS/FONT.BIN"),
|
|
__jabyengine_request_lba_for(ICON, "ASSETS/ICON.BIN"),
|
|
__jabyengine_end_lba_request
|
|
};
|
|
|
|
static void load_assets() {
|
|
static const JabyEngine::CDFile Assets[] = {
|
|
JabyEngine::CDFileBuilder::simple_tim(LBA::FONT, JabyEngine::SimpleTIM(320, 0, 320, 510)),
|
|
JabyEngine::CDFileBuilder::simple_tim(LBA::ICON, JabyEngine::SimpleTIM(320, 256, 320, 511)),
|
|
};
|
|
|
|
const auto buffer_cfg = JabyEngine::CDFileProcessor::BufferConfiguration::new_default();
|
|
JabyEngine::CDFileProcessor file_processor;
|
|
|
|
file_processor.setup(lba, Assets, buffer_cfg);
|
|
while(true) {
|
|
switch(file_processor.process()) {
|
|
case JabyEngine::Progress::InProgress:
|
|
break;
|
|
|
|
case JabyEngine::Progress::Done:
|
|
if(!file_processor.next(lba, buffer_cfg)) {
|
|
return;
|
|
}
|
|
break;
|
|
|
|
case JabyEngine::Progress::Error:
|
|
printf("Error detected! Aborting load\n");
|
|
return;
|
|
}
|
|
}
|
|
printf("Done loading assets!\n");
|
|
}
|
|
|
|
void main() {
|
|
static constexpr auto FirstOffsetX = 64;
|
|
const JabyEngine::GPU::POLY_F3 triangle({{0, 0}, {64, 64}, {0, 64}}, JabyEngine::GPU::Color24(0x0, 0xFF, 0xFF));
|
|
const JabyEngine::GPU::POLY_FT3 triangle2(
|
|
{{0, 0}, {64, 0}, {64, 64}}, {{0, 0}, {64, 0}, {64, 64}},
|
|
JabyEngine::GPU::TPage(320, 0, JabyEngine::GPU::SemiTransparency::B_Half_add_F_Half, JabyEngine::GPU::TexturePageColor::$4bit),
|
|
JabyEngine::GPU::PageClut(320, 510),
|
|
JabyEngine::GPU::Color24(0xFF, 0xFF, 0xFF));
|
|
const JabyEngine::GPU::POLY_G3 triangle3({
|
|
{{0 + FirstOffsetX, 0}, {0xFF, 0x0, 0x0}},
|
|
{{64 + FirstOffsetX, 64}, {0x0, 0xFF, 0x0}},
|
|
{{0 + FirstOffsetX, 64}, {0x0, 0x0, 0xFF}}});
|
|
const JabyEngine::GPU::POLY_GT3 triangle4({
|
|
{{0 + FirstOffsetX, 0}, {0, 0}, {0xFF, 0x0, 0x0}},
|
|
{{64 + FirstOffsetX, 64}, {64, 64}, {0x0, 0x0, 0xFF}},
|
|
{{64 + FirstOffsetX, 0}, {64, 0}, {0x0, 0xFF, 0x0}}},
|
|
JabyEngine::GPU::TPage(320, 0, JabyEngine::GPU::SemiTransparency::B_Half_add_F_Half, JabyEngine::GPU::TexturePageColor::$4bit),
|
|
JabyEngine::GPU::PageClut(320, 510));
|
|
|
|
load_assets();
|
|
|
|
while(true) {
|
|
JabyEngine::GPU::render(triangle);
|
|
JabyEngine::GPU::render(triangle2);
|
|
JabyEngine::GPU::render(triangle3);
|
|
JabyEngine::GPU::render(triangle4);
|
|
|
|
JabyEngine::GPU::swap_buffers_vsync(2);
|
|
}
|
|
}
|
|
__declare_lba_header(LBA); |