|
Zappy GUI
C++ graphic client: renderer, camera, network
|
Interpolates an entity's visual position from one tile to another. Handles toroidal wrap-around by teleporting the visual position to the entry edge mid-move. More...
#include <MoveBehavior.hpp>
Inheritance diagram for MoveBehavior:
Collaboration diagram for MoveBehavior:Public Member Functions | |
| MoveBehavior (VisualState &visual, int fromX, int fromY, int toX, int toY, int mapW, int mapH, float tileSize, float duration) | |
| void | update (float dt) override |
| bool | isDone () const override |
| Returns true when the behavior has completed and can be removed. | |
| float | getDuration () const override |
| Total duration of this behavior in seconds. | |
| float | minDuration () const override |
| Minimum duration below which this behavior is skipped entirely. | |
Public Member Functions inherited from IBehavior | |
| virtual | ~IBehavior ()=default |
Static Private Member Functions | |
| static float | _smoothstep (float t) |
Private Attributes | |
| VisualState & | _visual |
| Vector3 | _from |
| Vector3 | _to |
| float | _duration |
| float | _elapsed = 0.0f |
| bool | _wraps |
| Vector3 | _wrapExit = {} |
| Vector3 | _wrapEntry = {} |
| float | _splitT = 0.5f |
Interpolates an entity's visual position from one tile to another. Handles toroidal wrap-around by teleporting the visual position to the entry edge mid-move.
Definition at line 11 of file MoveBehavior.hpp.
| MoveBehavior::MoveBehavior | ( | VisualState & | visual, |
| int | fromX, | ||
| int | fromY, | ||
| int | toX, | ||
| int | toY, | ||
| int | mapW, | ||
| int | mapH, | ||
| float | tileSize, | ||
| float | duration | ||
| ) |
Definition at line 7 of file MoveBehavior.cpp.
References _from, _splitT, _to, _visual, _wrapEntry, _wrapExit, _wraps, VisualState::pos, and RenderingHelper::tileToWorld().
Here is the call graph for this function:
|
staticprivate |
s(t) = t²(3 - 2t) — ease-in/ease-out, zero derivative at t=0 and t=1
Definition at line 79 of file MoveBehavior.cpp.
Referenced by update().
Here is the caller graph for this function:
|
inlineoverridevirtual |
Total duration of this behavior in seconds.
Implements IBehavior.
Definition at line 18 of file MoveBehavior.hpp.
References _duration.
|
overridevirtual |
Returns true when the behavior has completed and can be removed.
Implements IBehavior.
Definition at line 76 of file MoveBehavior.cpp.
|
inlineoverridevirtual |
Minimum duration below which this behavior is skipped entirely.
Implements IBehavior.
Definition at line 19 of file MoveBehavior.hpp.
|
overridevirtual |
Implements IBehavior.
Definition at line 50 of file MoveBehavior.cpp.
References _duration, _elapsed, _from, _smoothstep(), _splitT, _to, _visual, _wrapEntry, _wrapExit, _wraps, and VisualState::pos.
Here is the call graph for this function:
|
private |
Definition at line 25 of file MoveBehavior.hpp.
Referenced by getDuration(), isDone(), and update().
|
private |
Definition at line 26 of file MoveBehavior.hpp.
|
private |
Definition at line 23 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 30 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 24 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 22 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 29 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 28 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().
|
private |
Definition at line 27 of file MoveBehavior.hpp.
Referenced by MoveBehavior(), and update().