Entities in the world are now animated like before using the new animation system.
This commit is contained in:
parent
594be65f45
commit
779599f030
9 changed files with 85 additions and 79 deletions
|
|
@ -67,6 +67,22 @@ namespace animation {
|
|||
rect_io.position.y += rect.position.y;
|
||||
}
|
||||
|
||||
void Animation::motion(sf::Transformable& sprite, sf::Vector2f pos, sf::Vector2f scale) {
|
||||
sequence.INVARIANT();
|
||||
|
||||
transform.apply(sequence, pos, scale);
|
||||
|
||||
if(transform.flipped) {
|
||||
scale.x *= -1;
|
||||
}
|
||||
|
||||
sprite.setPosition(pos);
|
||||
|
||||
if(transform.scaled) {
|
||||
sprite.setScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void Animation::motion(sf::View& view_out, sf::Vector2f pos, sf::Vector2f size) {
|
||||
dbc::check(size.x > 1.0f && size.y > 1.0f, "motion size must be above 1.0 since it's not a ratio");
|
||||
dbc::check(transform.flipped == false, "transform must be false, has no effect on View");
|
||||
|
|
@ -141,22 +157,6 @@ namespace animation {
|
|||
if(frame_change && onFrame != nullptr) onFrame();
|
||||
}
|
||||
|
||||
void Animation::motion(sf::Transformable& sprite, sf::Vector2f pos, sf::Vector2f scale) {
|
||||
sequence.INVARIANT();
|
||||
|
||||
transform.apply(sequence, pos, scale);
|
||||
|
||||
if(transform.flipped) {
|
||||
scale.x *= -1;
|
||||
}
|
||||
|
||||
sprite.setPosition(pos);
|
||||
|
||||
if(transform.scaled) {
|
||||
sprite.setScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void Timer::start() {
|
||||
clock.start();
|
||||
prev_time = clock.getElapsedTime().asSeconds();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue