Support proper scaling and other MATRIX operations

This commit is contained in:
2024-04-23 23:04:17 +02:00
parent b4099a7f97
commit 0d16995895
5 changed files with 133 additions and 32 deletions

View File

@@ -11,14 +11,14 @@ namespace GTETest {
namespace Jaby {
static constexpr auto Position = Make::PositionI16(GPU::Display::Width - 64, GPU::Display::Height - 64);
static constexpr GPU::POLY_FT4::Linked make_star_eye(GPU::PositionI16 pos) {
return Make::POLY_FT4(
static constexpr GTE_Sprite make_star_eye(GPU::PositionI16 pos) {
return GTE_Sprite::create(Make::POLY_FT4(
Make::AreaI16(pos, GPU::SizeI16(8, 8)),
JabySTARTim.get_page_offset_clut4().add(0, 64),
Make::TPage(JabySTARTim.get_texture_position(), GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4),
Make::PageClut(JabySTARTim.get_clut_position()),
GPU::Color24::Grey()
).linked();
).linked());
}
static auto star_base = Make::SPRT(
@@ -27,9 +27,10 @@ namespace GTETest {
Make::OffsetPageWithClut(JabySTARTim.get_page_offset_clut4(), Make::PageClut(JabySTARTim.get_clut_position()))
).linked();
static GPU::POLY_FT4::Linked star_eyes[2] = {
make_star_eye(Position.add(12, 31)),
make_star_eye(Position.add(33, 33))};
static GTE_Sprite star_eyes[2] = {
make_star_eye(Position.add(11, 30)),
make_star_eye(Position.add(33, 31))
};
}
static auto doener_fish = GTE_Sprite::create(Make::POLY_FT4(
@@ -38,12 +39,15 @@ namespace GTETest {
Make::TPage(Assets::Main::DoenerFishInfo.tim.get_texture_position(), GPU::SemiTransparency::B_add_F, GPU::TextureColorMode::clut4),
Make::PageClut(Assets::Main::DoenerFishInfo.tim.get_clut_position()),
GPU::Color24::Grey()
));
).linked());
static auto gbl_rotation = 0.0_deg;
static void setup() {
Jaby::star_base.concat(Jaby::star_eyes[0].concat(Jaby::star_eyes[1]));
Jaby::star_base.concat(Jaby::star_eyes[0].display.concat(Jaby::star_eyes[1].display));
Jaby::star_eyes[0].scale = 2.5_gf;
Jaby::star_eyes[1].scale = 3.5_gf;
doener_fish.area.position = GPU::PositionI16::create(100, 100);
Shared::back_menu.reset();
@@ -57,8 +61,11 @@ namespace GTETest {
return true;
}
auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
auto matrix = GTE::MATRIX::rotated(0.0_deg, 0.0_deg, -gbl_rotation); //(-gbl_rotation, gbl_rotation, -gbl_rotation);
doener_fish.apply(matrix);
Jaby::star_eyes[0].apply();
Jaby::star_eyes[1].apply();
doener_fish.angle += 25.0_deg;
gbl_rotation += 2.5_deg;
return false;