aboutsummaryrefslogtreecommitdiff
path: root/src/GameInitDispose.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GameInitDispose.cpp')
-rw-r--r--src/GameInitDispose.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/GameInitDispose.cpp b/src/GameInitDispose.cpp
index 9700e25..2928d5f 100644
--- a/src/GameInitDispose.cpp
+++ b/src/GameInitDispose.cpp
@@ -27,7 +27,6 @@
#include <AL/alc.h>
#include <GL/glu.h>
-#include "misc.h"
#include "Game.h"
#include "Support.h"
@@ -70,7 +69,7 @@ void resizeWindow(Game* game, int width, int height)
glViewport(0, 0, width, height);
}
-Game* makeGame(Config config)
+Game* makeGame(Config config, Scores scores)
{
auto game = new Game();
game->screenwidth = config.width;
@@ -93,20 +92,8 @@ Game* makeGame(Config config)
game->nummissions = config.levels.len;
game->debug = config.debug;
- // TODO: Read high score
- std::ifstream ipstream2 {"highscore.txt"};
- if (!ipstream2) {
- std::ofstream opstream("highscore.txt");
- opstream << (game->highscore = 0) << std::endl;
- opstream << (game->beatgame = 0) << std::endl;
- opstream.close();
- } else {
- ipstream2 >> game->highscore;
- ipstream2.ignore(256,'\n');
- ipstream2 >> game->beatgame;
- ipstream2.close();
- }
-
+ game->highscore = scores.high_score;
+ game->beatgame = scores.completed;
game->disttest = true;
game->cubetest = true;
setMenu(game, true);
@@ -1092,6 +1079,14 @@ GLvoid Game::ReSizeGLScene(float fov, float near)
glLoadIdentity();
}
+struct Scores getScores(Game* game)
+{
+ return {
+ .high_score = (size_t) game->highscore,
+ .completed = game->beatgame,
+ };
+}
+
void closeGame(Game* game)
{
const GLuint textures[] {