Improve load screen a lot

This commit is contained in:
Jaby 2024-10-05 16:25:08 +02:00
parent f20795ca20
commit 6a1c5e704a
6 changed files with 49 additions and 27 deletions

View File

@ -12,9 +12,15 @@ namespace Assets {
static constexpr auto PacoTIM = SimpleTIM::create(896, 0, 960, 510);
static constexpr auto DoenerFishInfo = ImageInfo{
.tim = SimpleTIM::create(896 + 30, 0, 960 + 16, 510),
.tim = SimpleTIM::create(896 + 30, 0, 960 + 16, 510),
.size = GPU::SizeI16::create(128, 64)
};
namespace JabyLoader {
static constexpr auto TIMLoaction = SimpleTIM::create(PacoTIM.get_texture_x(), PacoTIM.get_texture_y() + 128, 960 + 48, 510);
static constexpr auto JabyFrame = GPU::AreaI16::create(0, 0, 32, 44);
static constexpr auto FontFrame = GPU::AreaI16::create(0, 45, 186, 32);
};
void load();
}

View File

@ -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();

View File

@ -17,6 +17,7 @@ namespace Assets {
__jabyengine_start_lba_request
__jabyengine_request_lba_for(PACO, "ASSETS/MAIN/PACO.IMG"),
__jabyengine_request_lba_for(DFISH, "ASSETS/MAIN/DFISH.IMG"),
__jabyengine_request_lba_for(JABY_LOAD, "ASSETS/MAIN/LOAD.IMG"),
__jabyengine_request_lba_for(APPLE_SFX, "SFX/APPLE.VAG"),
__jabyengine_request_lba_for(BLUBB_SFX, "SFX/BLUBB.VAG"),
__jabyengine_request_lba_for(MIX_XA, "XAAUDIO/MIX.XA"),
@ -63,10 +64,11 @@ namespace Assets {
using SPU::operator""_vol;
static const CDFile Files[] = {
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM),
CDFileBuilder::simple_tim(LBA::DFISH, DoenerFishInfo.tim),
CDFileBuilder::sony_vag(LBA::APPLE_SFX, VAG::create(0, 1.0_vol)),
CDFileBuilder::sony_vag(LBA::BLUBB_SFX, VAG::create(1, 1.0_vol)),
CDFileBuilder::simple_tim(LBA::PACO, PacoTIM),
CDFileBuilder::simple_tim(LBA::DFISH, DoenerFishInfo.tim),
CDFileBuilder::simple_tim(LBA::JABY_LOAD, JabyLoader::TIMLoaction),
CDFileBuilder::sony_vag(LBA::APPLE_SFX, VAG::create(0, 1.0_vol)),
CDFileBuilder::sony_vag(LBA::BLUBB_SFX, VAG::create(1, 1.0_vol)),
CustomCDFileBuilder::jingle(32),
};

BIN
examples/PoolBox/assets/JabyTails.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -34,6 +34,9 @@ doener_fish_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS)
INPUT += $(OUTPUT_DIR)/JabyStar.img
JabyStar_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS)
INPUT += $(OUTPUT_DIR)/JabyTails.img
JabyTails_FLAGS = $(CLUT_4_COLOR_TRANS_FLAGS)
$(OUTPUT_DIR)/fox.xa: audio/temp/fox.wav
@mkdir -p $(OUTPUT_DIR)
jaby_engine_fconv $< -o $@ xa

View File

@ -28,6 +28,7 @@
<Directory name = "MAIN">
<File name = "PACO.IMG" lz4 = "already">../assets/bin/Paco.img</File>
<File name = "DFISH.IMG" lz4 = "already">../assets/bin/doener_fish.img</File>
<File name = "LOAD.IMG" lz4 = "already">../assets/bin/JabyTails.img</File>
</Directory>
<Directory name = "CONT">