Skip to content

Commit 6294d40

Browse files
committed
Code refactoring & add demo file
1 parent c6aaf78 commit 6294d40

File tree

6 files changed

+27
-12
lines changed

6 files changed

+27
-12
lines changed

OpenRocket/OpenRocket/Asteroid.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ float Asteroid::getRadius() const {
8787
float Asteroid::getY() const {
8888
return this->coordinates.y;
8989
}
90+
91+
void Asteroid::setToBeDeleted(bool t) {
92+
toBeDeleted = t;
93+
}
94+
95+
bool Asteroid::getToBeDeleted() const {
96+
return toBeDeleted;
97+
}

OpenRocket/OpenRocket/Asteroid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Asteroid {
3636
bool inLowerHalf();
3737
bool belowViewport();
3838

39-
bool getToBeDeleted() const { return toBeDeleted; }
39+
bool getToBeDeleted() const;
4040
float getX() const;
4141
float getY() const;
4242
float getRadius() const;
@@ -49,7 +49,7 @@ class Asteroid {
4949
void setX(float);
5050
void setY(float);
5151
void setTranslatedDistance(float);
52-
void setToBeDeleted(bool t) { toBeDeleted = t; }
52+
void setToBeDeleted(bool);
5353
void setAsteroidMatrix(glm::mat4);
5454
void setCurrentZone(string);
5555
};

OpenRocket/OpenRocket/Bullet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ void Bullet::setY(float y) {
4343
void Bullet::setTranslatedDistance(float distance) {
4444
translatedDistance = distance;
4545
}
46+
47+
bool Bullet::getToBeDeleted() const {
48+
return toBeDeleted;
49+
}
50+
51+
void Bullet::setToBeDeleted(bool t) {
52+
toBeDeleted = t;
53+
}

OpenRocket/OpenRocket/Bullet.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ class Bullet {
1919
float getX() const;
2020
float getY() const;
2121
float getTranslatedDistance() const;
22-
bool getToBeDeleted() { return toBeDeleted; }
23-
24-
static glm::vec4 bulletCenter;
25-
static glm::vec4 bulletPoint;
26-
glm::mat4 bulletMatrix;
22+
bool getToBeDeleted() const;
2723

2824
void setX(float);
2925
void setY(float);
3026
void setTranslatedDistance(float);
31-
void setToBeDeleted(bool t) { toBeDeleted = t; }
27+
void setToBeDeleted(bool);
3228

29+
static glm::vec4 bulletCenter;
30+
static glm::vec4 bulletPoint;
31+
glm::mat4 bulletMatrix;
3332
bool aboveViewport();
3433
};

OpenRocket/OpenRocket/Game.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,10 @@ void Game::CreateHeartBuffers() {
727727

728728
void Game::CreateGameOverBuffers() {
729729
GLfloat Vertices[] = {
730-
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
731-
Constants::maxX, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
732-
Constants::maxX, Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
733-
0.0f, Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
730+
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
731+
(GLfloat)Constants::maxX, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
732+
(GLfloat)Constants::maxX,(GLfloat)Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
733+
0.0f,(GLfloat)Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
734734
};
735735

736736
glGenVertexArrays(1, &gameOverVao);

demo.mp4

2.07 MB
Binary file not shown.

0 commit comments

Comments
 (0)