Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
MoveBehavior.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "IBehavior.hpp"
5#include "raylib.h"
6
11class MoveBehavior : public IBehavior {
12 public:
13 MoveBehavior(VisualState& visual, int fromX, int fromY, int toX, int toY, int mapW, int mapH,
14 float tileSize, float duration);
15
16 void update(float dt) override;
17 bool isDone() const override;
18 float getDuration() const override { return _duration; }
19 float minDuration() const override { return 0.0f; }
20
21 private:
23 Vector3 _from;
24 Vector3 _to;
25 float _duration;
26 float _elapsed = 0.0f;
27 bool _wraps;
28 Vector3 _wrapExit = {};
29 Vector3 _wrapEntry = {};
30 float _splitT = 0.5f;
31
32 static float _smoothstep(float t);
33};
Interface for entity visual behaviors (movement, rotation, animations, etc.). Behaviors are ticked ev...
Definition IBehavior.hpp:7
Interpolates an entity's visual position from one tile to another. Handles toroidal wrap-around by te...
bool isDone() const override
Returns true when the behavior has completed and can be removed.
float minDuration() const override
Minimum duration below which this behavior is skipped entirely.
Vector3 _wrapExit
float getDuration() const override
Total duration of this behavior in seconds.
VisualState & _visual
static float _smoothstep(float t)
void update(float dt) override
Vector3 _wrapEntry
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...