Now the Animation system is no more. Next is cleaning up the quick hacks I needed to finally get rid of it, like animate2::has.

This commit is contained in:
Zed A. Shaw 2026-02-23 23:41:14 -05:00
parent b504afef2a
commit 89ca204f3d
15 changed files with 356 additions and 423 deletions

View file

@ -141,44 +141,6 @@ namespace components {
std::string death;
};
struct Animation {
float min_x = 1.0f;
float min_y = 1.0f;
float max_x = 1.0f;
float max_y = 1.0f;
bool simple = true;
int frames = 1;
float speed = 0.3f;
ease::Style easing = ease::IN_OUT_BACK;
ease::Motion motion = ease::RUSH;
float ease_rate = 0.5f;
bool scaled = false;
bool stationary = false;
bool toggled = false;
bool looped = false;
bool flipped = false;
std::function<void()> end_cb = nullptr;
int current = 0;
bool playing = false;
float subframe = 0.0f;
// BUG: this is weirdly not used in most animations but also named wrong should be frame_width
int frame_width = -1;
int frame_height = -1;
bool apply(sf::Sprite& target, sf::Vector2f pos);
bool apply(sf::View& view_out, sf::Vector2f pos, sf::Vector2f size);
bool apply(sf::Transformable& target, sf::Vector2f pos);
void lerp(sf::Vector2f& scale_out, sf::Vector2f& pos_out);
void tween(sf::Vector2f& scale_out, sf::Vector2f& pos_out);
void next_frame();
void play();
float twitching();
void step(sf::Vector2f& scale_out, sf::Vector2f& pos_out, sf::IntRect& rect_out);
};
struct Player {
DinkyECS::Entity entity;
};
@ -201,10 +163,6 @@ namespace components {
ENROLL_COMPONENT(Combat, hp, max_hp, ap_delta, max_ap, damage, dead);
ENROLL_COMPONENT(Device, config, events);
ENROLL_COMPONENT(Storyboard, image, audio, layout, beats);
ENROLL_COMPONENT(Animation, min_x, min_y,
max_x, max_y, simple, frames,
speed, easing, motion, ease_rate,
scaled, stationary, toggled, looped, flipped);
ENROLL_COMPONENT(Sound, attack, death);
ENROLL_COMPONENT(Collision, has);