made animations extremely precise
parent
6e35a531c7
commit
50e4c506a0
|
@ -10,11 +10,11 @@ using namespace std;
|
|||
int main() {
|
||||
Shooter game;
|
||||
|
||||
game.create(1280, 720, ShooterConsts::PROJECT_NAME);
|
||||
//game.create(1280, 720, ShooterConsts::PROJECT_NAME);
|
||||
//game.create(1920, 1080, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
||||
|
||||
//game.create(2048, 1152, ShooterConsts::PROJECT_NAME, true);
|
||||
//game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
||||
game.create(3072, 1920, ShooterConsts::PROJECT_NAME, true, Consts::BACKGROUND_COLOR, sf::Style::Fullscreen);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -21,7 +21,8 @@ private:
|
|||
return;
|
||||
}
|
||||
|
||||
_object.lock()->rotateLeft(_rotationValue * dprogress());
|
||||
_object.lock()->rotateLeft(-_object.lock()->angleLeftUpLookAt().x());
|
||||
_object.lock()->rotateLeft(_rotationValue*(progress()));
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -17,6 +17,11 @@ bool Animation::updateState() {
|
|||
// linear normalized time:
|
||||
_dtime = Time::deltaTime() / _duration;
|
||||
|
||||
if(_time + _dtime > 1.0) {
|
||||
_dtime = 1.0 - _time;
|
||||
_finished = true;
|
||||
}
|
||||
|
||||
switch (_intType) {
|
||||
case InterpolationType::Bezier:
|
||||
_progress = Interpolation::Bezier(Consts::BEZIER[0], Consts::BEZIER[1], _time);
|
||||
|
@ -39,17 +44,7 @@ bool Animation::updateState() {
|
|||
"Animation::updateState: unknown interpolation type " + std::to_string(static_cast<int>(_intType))};
|
||||
}
|
||||
|
||||
if(_time + _dtime < 1.0) {
|
||||
_time += _dtime;
|
||||
} else {
|
||||
_dtime = 1.0 - _time;
|
||||
_time = 1.0;
|
||||
_dprogress = 1 - _progress;
|
||||
_progress = 1.0;
|
||||
update();
|
||||
_finished = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_looped == LoopOut::Continue && _time > 0.5) {
|
||||
_time = 0.5;
|
||||
|
|
Loading…
Reference in New Issue