-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameScene.h
135 lines (96 loc) · 2.85 KB
/
GameScene.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#pragma once
#include "scene.h"
#include <windows.h>
#define GRAVITY -15.0f
class Shader;
typedef struct BALL {
glm::mat4 modelmat{ glm::mat4(1.0f) };
float x{ 0.0f };
float y{ 0.8f };
float r{ 0.8f };
float g{ 0.619f };
float b{ 1.0f };
float rAngle{ 0.0f };
bool isJump{ false };
bool falling{ false };
void Init() {
x =0.0f;
y =1.0f;
r =0.8f;
g =0.619f;
b =1.0f;
rAngle =0.0f;
isJump = false;
falling = false;
}
}BALL;
typedef struct MOUSE {
float x{};
float y{};
float move{};
bool mouse_down{ true };
}MOUSE;
class gameScene : public scene {
public:
std::vector< glm::vec3 > vertices_sphere; //정점 저장 변수
std::vector< glm::vec3 > vertices_floor; //정점 저장 변수
std::vector< glm::vec3 > vertices_back; //정점 저장 변수
std::vector< glm::vec3 > vertices_ob1; //정점 저장 변수
std::vector< glm::vec2 > uvs_sphere;
std::vector< glm::vec2 > uvs_floor;
std::vector< glm::vec2 > uvs_back;
std::vector< glm::vec3 > normals_sphere; //노멀 저장 변수
std::vector< glm::vec2 > uvs_ob1;
std::vector< glm::vec3 > normals_floor; //노멀 저장 변수
std::vector< glm::vec3 > normals_ob1; //노멀 저장 변수
std::vector< glm::vec3 > normals_back; //노멀 저장 변수
glm::mat4 modelmat{ glm::mat4(1.0f) }; //모델 변환 행렬
glm::mat4 modelmat_f{ glm::mat4(1.0f) }; //모델 변환 행렬
glm::mat4 modelmat_ob1{ glm::mat4(1.0f) }; //모델 변환 행렬
GLuint VAO;
GLuint VBO_position[2];
GLuint VAO_f;
GLuint VBO_f_position[2];
GLuint VAO_ob1;
GLuint VBO_ob1_position[2];
GLuint VAO_back;
GLuint VBO_back_position[2];
Shader ourShader;
Shader ourShader2;
BALL ball;
MOUSE mouse;
float floor_FirstZ{}; //화면에 보이는 바닥 타일 중 제일 작은 z좌표값
int index{}; //바닥 시작 인덱스
int lifePoint{3}; //목숨
int** map;
float floor_xPos = -2.0f;
float floor_zPos = 0.0f;
float speed{};
float sizeOfWallx = 3.0f;
float sizeOfWally = 0.01f;
float sizeOfWallz = 3.0f;
float ball_y = 0.12f;
float obstacle_speed[5]{ 4.0f, 5.0f,6.0f, 7.0f, 8.0f }; //각각 장애물 속도
float obstacle_y[5]{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; //각각 장애물 높이
bool obstacle_up[5]{ true, true, false, false, true }; //각각 장애물 up or down
bool clearStage = false;
bool overStage = false;
bool pause{ false };
bool testmode{ false };
////텍스처 쉐이더 uniform 변수 위치
//unsigned int viewLocation2, projectionLocation2, modelLocation2;
//unsigned int texture;
public:
~gameScene();
void InitMap();
void InitTexture();
void drawModel();
void SoundSystem();
void Play(int Sound_num, int cannel);
virtual void init() override;
virtual void processKey(unsigned char key, int x, int y) override;
virtual void Mouse(int button, int state, int x, int y) override;
virtual void MouseMotion(int x, int y) override;
virtual void Update(const float frametime) override;
virtual void Render() override;
};