#pragma once #include "Component.hpp" #include "raylib.h" #include #include /** * Stores and renders a fading positional trail for moving entities. * * Points are timestamped and retired from the front of a queue once they * exceed `pointLifetime`, so updates avoid touching every point each frame. */ struct TrailComponent : public Component { struct Point { float x = 0.0f; float y = 0.0f; float createdAt = 0.0f; }; std::deque points; float elapsed = 0.0f; float lastSampleAt = 0.0f; float sampleDistance = 5.0f; float sampleInterval = 1.0f / 30.0f; float pointLifetime = 0.85f; float lineWidth = 2.0f; std::size_t maxPoints = 96; Color color = Color{120, 210, 255, 180}; void Setup() override; void Update(float dt) override; void Cleanup() override; void Draw() const; };