-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameScreen.cpp
More file actions
57 lines (41 loc) · 1.19 KB
/
Copy pathGameScreen.cpp
File metadata and controls
57 lines (41 loc) · 1.19 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
51
52
53
54
55
56
57
#include "stdafx.h"
#include "GameScreen.h"
#include "MineWorld.h"
#include "OpenGl.h"
namespace XKS {
GameScreen::GameScreen()
: m_world(nullptr) {
}
GameScreen::~GameScreen() {
}
void GameScreen::Load() {
m_world = std::make_shared<MineWorld>();
m_world->Load();
printf("World Loaded \n");
}
void GameScreen::Unload() {
m_world->Unload();
}
void GameScreen::Draw() {
m_world->Draw();
}
void GameScreen::Update(double dt) {
if (ApplicationWindow::GetInstance()->IsFocused()) {
m_world->Update(dt);
}
}
void GameScreen::Resize(int width, int height) {
if (m_world == nullptr)
return;
// parametry bry³y obcinania - rzutowanie perspektywiczne
auto app = ApplicationWindow::GetInstance();
OpenGL::GetInstance()->UpdateProjectionMatrix(app->GetFoV(), app->GetAspect(), 0.1f, app->GetClippingDistance());
}
void GameScreen::KeyAction(int key, int scancode, int action, int mods) {
if ((key == GLFW_KEY_ESCAPE) && action == GLFW_RELEASE) {
ApplicationWindow::GetInstance()->CloseApplication();
}
}
void GameScreen::MouseAction(int button, int action, int mods) {
}
}