Improve load screen a lot
This commit is contained in:
@@ -236,36 +236,43 @@ namespace NormalScene {
|
||||
}
|
||||
|
||||
namespace LoadingScene {
|
||||
static SimpleTimer<uint8_t> jaby_timer;
|
||||
static uint8_t jaby_frame_offset;
|
||||
|
||||
static void update() {
|
||||
static const char Title[] = "Loading...";
|
||||
static constexpr auto TitleLength = (sizeof(Title) - 1)*DefaultFont::Info.get_font_size().width;
|
||||
|
||||
auto cursor = FontWriter::update(JabyEngine::Make::PositionI16((GPU::Display::Width-TitleLength)/2, (GPU::Display::Height-16)/2));
|
||||
FontWriter::new_font_writer.write(cursor, Title, GPU::Color24::Blue(0xD0));
|
||||
jaby_timer.reset();
|
||||
jaby_frame_offset = 0;
|
||||
}
|
||||
|
||||
static void render() {
|
||||
FontWriter::new_font_writer.render();
|
||||
}
|
||||
static void vsync_render() {
|
||||
static constexpr auto StartPosition = Make::PositionI16(24, 64);
|
||||
const auto load_font = Make::SPRT(
|
||||
Make::AreaI16(StartPosition.move(Assets::Main::JabyLoader::JabyFrame.size.width + 8, 0), Assets::Main::JabyLoader::FontFrame.size),
|
||||
Make::OffsetPageWithClut(Assets::Main::JabyLoader::TIMLoaction.get_page_offset_clut4().move(Assets::Main::JabyLoader::FontFrame.position.x, Assets::Main::JabyLoader::FontFrame.position.y), Make::PageClut(Assets::Main::JabyLoader::TIMLoaction.get_clut_position())),
|
||||
GPU::Color24::Grey()
|
||||
);
|
||||
auto jaby_sprt = Make::SPRT(
|
||||
Make::AreaI16(StartPosition, Assets::Main::JabyLoader::JabyFrame.size),
|
||||
Make::OffsetPageWithClut(Assets::Main::JabyLoader::TIMLoaction.get_page_offset_clut4(), Make::PageClut(Assets::Main::JabyLoader::TIMLoaction.get_clut_position())),
|
||||
GPU::Color24::Grey()
|
||||
);
|
||||
|
||||
// TODO: No good name
|
||||
static void test() {
|
||||
const auto triangle1 = Make::POLY_F3({
|
||||
Make::Vertex(0, 0),
|
||||
Make::Vertex(128, 128),
|
||||
Make::Vertex(0, 128)},
|
||||
GPU::Color24::Blue());
|
||||
if(jaby_timer.is_expired_for(500_ms)) {
|
||||
jaby_frame_offset = jaby_frame_offset ? 0 : 32;
|
||||
jaby_timer.reset();
|
||||
}
|
||||
jaby_sprt.tex_offset.add(jaby_frame_offset, 0);
|
||||
|
||||
GPU::swap_buffers(false);
|
||||
GPU::render(triangle1);
|
||||
GPU::swap_buffers();
|
||||
GPU::render(jaby_sprt);
|
||||
GPU::render(load_font);
|
||||
jaby_sprt.position.move(Assets::Main::JabyLoader::FontFrame.size.width + Assets::Main::JabyLoader::JabyFrame.size.width + 8, 0);
|
||||
GPU::render(jaby_sprt);
|
||||
}
|
||||
|
||||
static void run() {
|
||||
if(Shared::load_test || old_state_changer != state_changer) {
|
||||
update();
|
||||
render();
|
||||
|
||||
GPU::set_vsync_callback(test);
|
||||
if(Shared::load_test || old_state_changer != state_changer) {
|
||||
GPU::set_vsync_callback(vsync_render);
|
||||
|
||||
cd_player.push();
|
||||
state_changer.asset_load();
|
||||
|
Reference in New Issue
Block a user