forked from Shell4026/ShellEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUniformTest.cpp
More file actions
50 lines (46 loc) · 1.31 KB
/
Copy pathUniformTest.cpp
File metadata and controls
50 lines (46 loc) · 1.31 KB
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
47
48
49
50
#include "UniformTest.h"
#include "Game/GameObject.h"
#include "Game/Input.h"
namespace sh::game
{
UniformTest::UniformTest(GameObject& owner) :
Component(owner),
mat(nullptr)
{
}
void UniformTest::SetMaterial(sh::render::Material& mat)
{
this->mat = &mat;
}
void UniformTest::Update()
{
if (Input::GetKeyDown(Input::KeyCode::A))
{
auto pos = gameObject.transform->position;
pos.x -= 1 * gameObject.world.deltaTime;
gameObject.transform->SetPosition(pos);
}
if (Input::GetKeyDown(Input::KeyCode::D))
{
auto pos = gameObject.transform->position;
pos.x += 1 * gameObject.world.deltaTime;
gameObject.transform->SetPosition(pos);
}
if (Input::GetKeyDown(Input::KeyCode::W))
{
auto pos = gameObject.transform->position;
pos.z -= 1 * gameObject.world.deltaTime;
gameObject.transform->SetPosition(pos);
}
if (Input::GetKeyDown(Input::KeyCode::S))
{
auto pos = gameObject.transform->position;
pos.z += 1 * gameObject.world.deltaTime;
gameObject.transform->SetPosition(pos);
}
Vec3 pos = gameObject.transform->position;
Vec3 rot = gameObject.transform->rotation;
gameObject.transform->SetRotation(rot + Vec3{ 0.0f, 45 * gameObject.world.deltaTime, 0.0f });
//gameObject.transform->SetPosition(pos + glm::vec3(0.f, 0.2 * gameObject.world.deltaTime, 0.f));
}
}