-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameObjects.hpp
80 lines (65 loc) · 1.74 KB
/
gameObjects.hpp
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
#include "headers.hpp"
#ifndef GAMEOBJECTS_H
#define GAMEOBJECTS_H
typedef struct block Block;
typedef struct pBlock pieceBlock;
typedef struct sTile switchTile;
struct block{
GLuint VAO, VBO, EBO, texture;
int texType;
vec3 position;
int x, z; // based on index of layout
mat4 modelMatrix; // changed
bool isAvailable;
int texWidth, texHeight;
vector<GLfloat> Vertices;
vector<GLuint> Indices;
};
struct pBlock{
GLuint VAO, VBO,EBO, texture;
vec3 position;
int texWidth, texHeight;
mat4 modelMatrix;
vec3 rightAxis, leftAxis, upAxis, downAxis;
vec3 right, left, up, down;
GLfloat length, breadth, height;
vector<GLfloat> Vertices;
vector<GLuint> Indices;
};
struct sTile{
int x, z;
int targetX, targetZ;
};
class gameObjects{
public:
int dx, dy, dz;
bool isFalling;
GLfloat rotateAngleFalling;
vec3 transPos, axis;
GLfloat downFall = 0.0f;
vec3 rightAxis, leftAxis, upAxis, downAxis;
int goalX, goalZ;
gameObjects();
void setMVP(GLint programId, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix);
vector<pieceBlock> Blocks;
void initBlock();
void initBlock(vec3 position, int Tex);
void buildBlock(vector<GLfloat> &Vertices, vector<GLuint> &Indices);
void displayBlock();
void rotation(int Dx, int Dy, int Dz, GLfloat ROTATE);
void rotationController(int Dx, int Dy, int Dz, GLfloat ROTATE);
void rotateUpdater();
void fallCheck(int Dx, int Dz);
void fallRotate(int Dx, int Dz, vec3 transPos, vec3 axis, GLfloat ROTATE);
void keepFalling();
int layout[20][20];
vector<Block> Tiles;
void initLayout();
void initTiles();
void buildTileBlock(vector<GLfloat> &Vertices, vector<GLuint> &Indices);
void displayTiles();
vector<switchTile> switchTiles;
void rotateTile();
void rotateTileUtil(int x, int z);
};
#endif