Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
TurnBehavior.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IBehavior.hpp"
5
9class TurnBehavior : public IBehavior {
10 public:
11 TurnBehavior(VisualState& visual, float fromAngle, float toAngle, float duration);
12
13 void update(float dt) override;
14 bool isDone() const override;
15 float getDuration() const override { return _duration; }
16 float minDuration() const override { return 0.0f; }
17
18 private:
21 float _delta;
22 float _duration;
23 float _elapsed = 0.0f;
24
25 static float _smoothstep(float t);
26};
float toAngle(Orientation orientation)
Returns the Y rotation angle (degrees) for a given orientation.
Interface for entity visual behaviors (movement, rotation, animations, etc.). Behaviors are ticked ev...
Definition IBehavior.hpp:7
Interpolates an entity's visual angle from one value to another over a specified duration.
void update(float dt) override
float getDuration() const override
Total duration of this behavior in seconds.
bool isDone() const override
Returns true when the behavior has completed and can be removed.
static float _smoothstep(float t)
VisualState & _visual
float minDuration() const override
Minimum duration below which this behavior is skipped entirely.
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...