Finish GTE test

This commit is contained in:
2024-04-25 23:18:05 +02:00
parent 35cfcf37db
commit 917f85a418
3 changed files with 75 additions and 22 deletions

View File

@@ -16,7 +16,7 @@ namespace GTETest {
} animation[] = {
{.scale_left = 1.0_gf, .scale_right = 1.0_gf},
{.scale_left = 1.0_gf, .scale_right = 1.0_gf},
{.scale_left = 1.2_gf, .scale_right = 1.5_gf},
{.scale_left = 1.5_gf, .scale_right = 1.2_gf},
{.scale_left = 1.2_gf, .scale_right = 1.5_gf},
@@ -68,6 +68,22 @@ namespace GTETest {
};
}
namespace Background {
static constexpr GPU::AreaI16 Area[2] = {
Make::AreaI16(-30, -30, 350, 350),
Make::AreaI16(0, 0, GPU::Display::Width, GPU::Display::Width),
};
static constexpr GPU::PositionI16 AreaPivot[2] = {
Make::PositionI16(Area[0].size.width/2, Area[0].size.height/2),
Make::PositionI16(Area[1].size.width/2, Area[1].size.height/2),
};
static GPU::POLY_G4 poly[2] = {
Make::POLY_G4(Area[0], {GPU::Color24::Blue(), GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Purple()}),
Make::POLY_G4(Area[1], {GPU::Color24::Blue(), GPU::Color24::Red(), GPU::Color24::Green(), GPU::Color24::Purple()}),
};
}
static auto doener_fish = GTE_Sprite::create(Make::POLY_FT4(
Make::AreaI16(Make::PositionI16(0, 0), Assets::Main::DoenerFishInfo.size),
Assets::Main::DoenerFishInfo.tim.get_page_offset_clut4(),
@@ -89,7 +105,7 @@ namespace GTETest {
Shared::back_menu.reset();
GTE::set_geom_offset(0, 0);
GTE::set_geom_screen(512);
GTE::set_geom_screen(256);
}
static bool update_or_exit() {
@@ -106,7 +122,16 @@ namespace GTETest {
Jaby::animation_timer.reset();
}
auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
for(size_t n = 0; n < sizeof(Background::poly)/sizeof(Background::poly[0]); n++) {
auto matrix = [](size_t n) -> GTE::MATRIX {
auto matrix = GTE::MATRIX::translated(-Background::AreaPivot[n].x, -Background::AreaPivot[n].y);
matrix.rotate(0.0_deg, 0.0_deg, (n == 0) ? gbl_rotation : -gbl_rotation);
return matrix.translate(Background::Area[n].position.x + Background::AreaPivot[n].x, Background::Area[n].position.y + Background::AreaPivot[n].y);
}(n);
matrix.apply_to_area(Background::poly[n], Make::AreaI16(Make::PositionI16(), Background::Area[n].size));
}
const auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
doener_fish.apply(matrix);
Jaby::star_eyes[0].apply();
Jaby::star_eyes[1].apply();
@@ -117,6 +142,9 @@ namespace GTETest {
}
static void render() {
for(const auto& poly : Background::poly) {
GPU::render(poly);
}
doener_fish.render();
GPU::render(Jaby::star_base);
Shared::back_menu.render();
@@ -130,7 +158,7 @@ namespace GTETest {
if(update_or_exit()) {
break;
}
GPU::swap_buffers_vsync(1);
GPU::swap_buffers_vsync(1, false);
render();
}
}