Add Jaby eyes animation
This commit is contained in:
parent
f2f259cb5a
commit
ef93713f7d
|
@ -9,7 +9,42 @@ namespace GTETest {
|
||||||
using namespace GTETest;
|
using namespace GTETest;
|
||||||
|
|
||||||
namespace Jaby {
|
namespace Jaby {
|
||||||
static constexpr auto Position = Make::PositionI16(GPU::Display::Width - 64, GPU::Display::Height - 64);
|
static constexpr auto AnimationTime = 250_ms;
|
||||||
|
static const struct {
|
||||||
|
gte_float scale_left;
|
||||||
|
gte_float scale_right;
|
||||||
|
} 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},
|
||||||
|
{.scale_left = 1.5_gf, .scale_right = 1.2_gf},
|
||||||
|
|
||||||
|
{.scale_left = 1.8_gf, .scale_right = 2.3_gf},
|
||||||
|
{.scale_left = 2.3_gf, .scale_right = 1.8_gf},
|
||||||
|
{.scale_left = 1.8_gf, .scale_right = 2.3_gf},
|
||||||
|
{.scale_left = 2.3_gf, .scale_right = 1.8_gf},
|
||||||
|
|
||||||
|
{.scale_left = 3.2_gf, .scale_right = 4.5_gf},
|
||||||
|
{.scale_left = 4.5_gf, .scale_right = 3.2_gf},
|
||||||
|
{.scale_left = 3.2_gf, .scale_right = 4.5_gf},
|
||||||
|
{.scale_left = 4.5_gf, .scale_right = 3.2_gf},
|
||||||
|
|
||||||
|
{.scale_left = 1.8_gf, .scale_right = 2.3_gf},
|
||||||
|
{.scale_left = 2.3_gf, .scale_right = 1.8_gf},
|
||||||
|
{.scale_left = 1.8_gf, .scale_right = 2.3_gf},
|
||||||
|
{.scale_left = 2.3_gf, .scale_right = 1.8_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},
|
||||||
|
{.scale_left = 1.5_gf, .scale_right = 1.2_gf},
|
||||||
|
};
|
||||||
|
static IntervalTimer<uint8_t> animation_timer;
|
||||||
|
static auto animation_id = 0;
|
||||||
|
static constexpr auto Position = Make::PositionI16(GPU::Display::Width - 64, GPU::Display::Height - 64);
|
||||||
|
|
||||||
static constexpr GTE_Sprite make_star_eye(GPU::PositionI16 pos) {
|
static constexpr GTE_Sprite make_star_eye(GPU::PositionI16 pos) {
|
||||||
return GTE_Sprite::create(Make::POLY_FT4(
|
return GTE_Sprite::create(Make::POLY_FT4(
|
||||||
|
@ -45,8 +80,10 @@ namespace GTETest {
|
||||||
|
|
||||||
static void setup() {
|
static void setup() {
|
||||||
Jaby::star_base.concat(Jaby::star_eyes[0].display.concat(Jaby::star_eyes[1].display));
|
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[0].scale = Jaby::animation[0].scale_right;
|
||||||
Jaby::star_eyes[1].scale = 3.5_gf;
|
Jaby::star_eyes[1].scale = Jaby::animation[0].scale_left;
|
||||||
|
Jaby::animation_id = 1;
|
||||||
|
Jaby::animation_timer = IntervalTimer<uint8_t>::create(Jaby::AnimationTime);
|
||||||
|
|
||||||
doener_fish.area.position = GPU::PositionI16::create(100, 100);
|
doener_fish.area.position = GPU::PositionI16::create(100, 100);
|
||||||
Shared::back_menu.reset();
|
Shared::back_menu.reset();
|
||||||
|
@ -61,7 +98,15 @@ namespace GTETest {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto matrix = GTE::MATRIX::rotated(0.0_deg, 0.0_deg, -gbl_rotation); //(-gbl_rotation, gbl_rotation, -gbl_rotation);
|
if(Jaby::animation_timer.is_expired()) {
|
||||||
|
Jaby::star_eyes[0].scale = Jaby::animation[Jaby::animation_id].scale_right;
|
||||||
|
Jaby::star_eyes[1].scale = Jaby::animation[Jaby::animation_id].scale_left;
|
||||||
|
|
||||||
|
Jaby::animation_id = (Jaby::animation_id + 1)%(sizeof(Jaby::animation)/sizeof(Jaby::animation[0]));
|
||||||
|
Jaby::animation_timer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto matrix = GTE::MATRIX::rotated(-gbl_rotation, gbl_rotation, -gbl_rotation);
|
||||||
doener_fish.apply(matrix);
|
doener_fish.apply(matrix);
|
||||||
Jaby::star_eyes[0].apply();
|
Jaby::star_eyes[0].apply();
|
||||||
Jaby::star_eyes[1].apply();
|
Jaby::star_eyes[1].apply();
|
||||||
|
|
Loading…
Reference in New Issue