-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
54 lines (41 loc) · 1.33 KB
/
main.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
47
48
49
50
51
52
53
54
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
#include <string>
#include "Game.h"
class Platformer : public Game {
public:
Platformer(const std::string& title, const int& width, const int& height)
: Game(title, width, height, "./data/resource.csv",
"./data/gameobject.dat") {}
void getInput() override {
if (isKeyDown(GLFW_KEY_ESCAPE))
glfwSetWindowShouldClose(glfwWindow, GLFW_TRUE);
if (isKeyDown(GLFW_KEY_G)) changeMode();
if (isKeyPressed(GLFW_KEY_LEFT))
input(eInputStatus::LEFT);
else if (isKeyPressed(GLFW_KEY_RIGHT))
input(eInputStatus::RIGHT);
else if (isKeyPressed(GLFW_KEY_UP))
input(eInputStatus::UP);
else if (isKeyPressed(GLFW_KEY_DOWN))
input(eInputStatus::DOWN);
else if (isKeyUp(GLFW_KEY_LEFT) || isKeyUp(GLFW_KEY_RIGHT))
input(eInputStatus::ARROW_RELEASE);
if (isEditorMode == true) {
if (isKeyUp(GLFW_KEY_UP) || isKeyUp(GLFW_KEY_DOWN))
input(eInputStatus::ARROW_RELEASE);
}
if (isKeyUp(GLFW_KEY_F))
input(eInputStatus::JUMP_RELEASE);
else if (isKeyDown(GLFW_KEY_F))
input(eInputStatus::JUMP_PRESS);
updateKeyStatus();
}
};
int main() {
Platformer platformerExample("GELDA", 1024, 1024);
platformerExample.run();
std::cout << "See U GELDA!" << std::endl;
return 0;
}