Files
OpenEngine/open_engine/include/open_engine/orthographic_camera_controller.hpp
2026-02-05 17:06:20 +01:00

48 lines
1.4 KiB
C++

#ifndef ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP
#define ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP
#include "open_engine/orthographic_camera.hpp"
#include "open_engine/events/application_event.hpp"
#include "open_engine/events/mouse_event.hpp"
#include "open_engine/events/event.hpp"
#include <glm/fwd.hpp>
namespace OpenEngine {
class OrthographicCameraController
{
public:
OrthographicCameraController(float ratio, float zoom);
void OnUpdate();
void OnEvent(Event& e);
void OnResize(float width, float height);
const OrthographicCamera& GetCamera() const { return camera; };
OrthographicCamera& GetCamera() { return camera; };
float GetZoom() const { return zoom; }
void SetZoom(float level) { zoom = level; };
private:
bool OnMouseScrolled(MouseScrolledEvent& e);
bool OnWindowResized(WindowResizeEvent& e);
void Translate(const glm::vec3& vector);
void Rotate(float speed);
private:
float aspect_ratio;
float zoom = 1.0f;
OrthographicCamera camera;
bool rotation;
glm::vec3 camera_position = {0.0f, 0.0f, 0.0f};
float camera_rotation = 0.0f;
float translation_speed = 5.0f, rotation_speed = 180.0f;
};
}
#endif // ORTHOGRAPHIC_CAMERA_CONTROLLER_HPP