Skip to content

File CameraComponent.hpp

File List > Components > CameraComponent.hpp

Go to the documentation of this file

#ifndef ENGINE_COMPONENTS_CAMERACOMPONENT_HPP_
#define ENGINE_COMPONENTS_CAMERACOMPONENT_HPP_

#include "ECS/Entity.hpp"
#include <optional>
#include <raylib.h>

namespace Engine {
struct CameraComponent {
    float zoom;

    bool primary;

    std::optional<Entity> followTarget;

    float followSpeed;

    bool clampToBounds;

    Rectangle bounds;

    float shakeTrauma;

    float shakeMagnitude;

    float shakeDecay;

    float shakeOffsetX = 0.0f;

    float shakeOffsetY = 0.0f;

    CameraComponent(float zoom = 1.0f, bool primary = true)
        : zoom(zoom), primary(primary), followTarget(std::nullopt), followSpeed(0.0f),
          clampToBounds(false), bounds{0.0f, 0.0f, 0.0f, 0.0f}, shakeTrauma(0.0f),
          shakeMagnitude(10.0f), shakeDecay(1.5f) {}
};
} // namespace Engine

#endif // ENGINE_COMPONENTS_CAMERACOMPONENT_HPP_