MCPcopy Create free account
hub / github.com/JeanPhilippeKernel/RendererEngine / Update

Method Update

ZEngine/src/OrthographicCameraController.cpp:17–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 }
16
17 void OrthographicCameraController::Update(Core::TimeStep dt) {
18 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_LEFT, m_window.lock())) {
19 m_position.x -= m_move_speed * dt;
20 m_orthographic_camera->SetPosition(m_position);
21 }
22
23 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_RIGHT, m_window.lock())) {
24 m_position.x += m_move_speed * dt;
25 m_orthographic_camera->SetPosition(m_position);
26 }
27
28 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_UP, m_window.lock())) {
29 m_position.y += m_move_speed * dt;
30 m_orthographic_camera->SetPosition(m_position);
31 }
32
33 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_DOWN, m_window.lock())) {
34 m_position.y -= m_move_speed * dt;
35 m_orthographic_camera->SetPosition(m_position);
36 }
37
38 if (m_can_rotate) {
39 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_Q, m_window.lock())) {
40 m_rotation_angle += m_rotation_speed * dt;
41 }
42
43 if (IDevice::As<Inputs::Keyboard>()->IsKeyPressed(ZENGINE_KEY_D, m_window.lock())) {
44 m_rotation_angle -= m_rotation_speed * dt;
45 }
46
47 m_orthographic_camera->SetRotation(m_rotation_angle);
48 }
49 }
50
51 const Maths::Vector3& OrthographicCameraController::GetPosition() const {
52 return m_orthographic_camera->GetPosition();

Callers

nothing calls this directly

Calls 3

SetRotationMethod · 0.80
IsKeyPressedMethod · 0.45
SetPositionMethod · 0.45

Tested by

no test coverage detected