-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeveloper.cpp
47 lines (36 loc) · 1.03 KB
/
Developer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "Developer.h"
#include "Engine.h"
Developer :: Developer(Input* input)
{
m_pInput = input;
}
Developer :: ~Developer()
{
}
void Developer :: logic(unsigned int a)
{
float t = a * 0.001f;
if(m_pInput->keyd(SDLK_F1))
Engine::get().clearToState("game");
else if(m_pInput->keyd(SDLK_F2))
Engine::get().clearToState("editor");
if(m_pInput->keyd(SDLK_F12))
m_pInput->toggleHideMouse();
if(m_pInput->keyd(SDLK_ESCAPE))
Engine::get().quit();
std::shared_ptr<Node> movable;
if(movable = m_wpMovable.lock()) {
float speed = 5.0f;
if(m_pInput->key(SDLK_UP))
movable->move(glm::vec3(0.0f, 0.0f, -speed*t));
if(m_pInput->key(SDLK_DOWN))
movable->move(glm::vec3(0.0f, 0.0f, speed*t));
if(m_pInput->key(SDLK_LEFT))
movable->move(glm::vec3(-speed*t, 0.0f, 0.0f));
if(m_pInput->key(SDLK_RIGHT))
movable->move(glm::vec3(speed*t, 0.0f, 0.0f));
}
}
void Developer :: render() const
{
}