engine/test/src/camera_controller.hpp

34 lines
715 B
C++
Raw Normal View History

2022-11-07 20:15:26 +00:00
#pragma once
2023-01-05 13:21:33 +00:00
#include "ecs_system.hpp"
#include "event_system.hpp"
#include "systems/collisions.hpp"
2022-11-07 20:15:26 +00:00
2023-01-05 13:21:33 +00:00
struct CameraControllerComponent {
2022-11-07 20:15:26 +00:00
float m_cameraSensitivity = 0.007f;
float m_yaw = 0.0f;
float m_pitch = 0.0f;
2022-11-23 15:40:10 +00:00
const float walk_speed = 4.0f;
2022-11-07 20:15:26 +00:00
bool isGrounded = false;
2022-11-07 20:15:26 +00:00
float dy = 0.0f;
float standingHeight = 0.0f;
2022-11-23 15:40:10 +00:00
const float thrust = 25.0f;
2023-01-22 18:20:10 +00:00
2023-01-05 13:21:33 +00:00
};
class CameraControllerSystem : public engine::System, public engine::EventHandler<engine::PhysicsSystem::CollisionEvent> {
2023-01-05 13:21:33 +00:00
public:
CameraControllerSystem(engine::Scene* scene);
2022-11-07 20:15:26 +00:00
// engine::System overrides
2023-01-05 13:21:33 +00:00
void onUpdate(float ts) override;
// engine::EventHandler overrides
void onEvent(engine::PhysicsSystem::CollisionEvent info) override;
2022-11-07 20:15:26 +00:00
};