kaliber/src/engine/animatable.cc

34 lines
559 B
C++
Raw Normal View History

#include "engine/animatable.h"
2020-04-13 11:24:53 +00:00
#include <cmath>
using namespace base;
namespace eng {
2021-02-18 14:42:08 +00:00
void Animatable::Translate(const Vector2f& pos) {
position_ += pos;
2020-04-13 11:24:53 +00:00
}
2021-02-18 14:42:08 +00:00
void Animatable::Scale(const Vector2f& scale) {
scale_ = scale;
2020-04-13 11:24:53 +00:00
}
void Animatable::Scale(float scale) {
scale_ = {scale, scale};
2020-04-13 11:24:53 +00:00
}
void Animatable::Rotate(float angle) {
theta_ += angle;
rotation_.x = sin(theta_);
rotation_.y = cos(theta_);
}
void Animatable::SetTheta(float theta) {
theta_ = theta;
rotation_.x = sin(theta_);
rotation_.y = cos(theta_);
}
} // namespace eng