diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9d5cc1b..2aa1416 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,6 +7,7 @@
+
{
"useNewFormat": true
@@ -30,12 +31,11 @@
-
-
-
-
+
+
+
@@ -87,7 +87,7 @@
"RunOnceActivity.west.config.association.type.startup.service": "true",
"cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true",
- "git-widget-placeholder": "main",
+ "git-widget-placeholder": "Zeit__zaeler",
"last_opened_file_path": "C:/Desktop/StudiumME/3.Sem/Prog3/B/MatrixPybind",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
@@ -98,11 +98,6 @@
}
}]]>
-
-
-
-
-
diff --git a/Highscores.txt b/Highscores.txt
index e69de29..c8467e2 100644
--- a/Highscores.txt
+++ b/Highscores.txt
@@ -0,0 +1 @@
+11.34
\ No newline at end of file
diff --git a/ScoreManager.cpp b/ScoreManager.cpp
index 99c59b0..6cfc66c 100644
--- a/ScoreManager.cpp
+++ b/ScoreManager.cpp
@@ -5,6 +5,7 @@
ScoreManager::ScoreManager(const std::string& filename) : highscoreFile(filename)
{
+ std::cout << "test";
loadHighscore();
}
@@ -23,8 +24,6 @@ void ScoreManager::loadHighscore() {
void ScoreManager::incrementScore() {
currentScore++;
-
-
}
void ScoreManager::resetScore() {
diff --git a/main.cpp b/main.cpp
index 00aa2b1..6a8db51 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3,6 +3,8 @@
#include "userinterface.h"
#include
#include
+#include
+
#include "ScoreManager.h"
// -----------------------------------------------------------
@@ -30,20 +32,23 @@ int main()
camera.projection = CAMERA_PERSPECTIVE;
//TODO: Hier die Zeit abrufen.
- double currentScoreTime = 11.42;
- double highScoreTime = 15.41;
+ double currentScoreTime = 0.0;
+ double startTime = 0.0;
+ double highScoreTime = 43.4;
//TODO: Hier die Anzahl der Züge abrufen.
int currentScoreTurns = 0;
int highScoreTurns = score.getHighScore();
- if (currentScoreTime <= highScoreTime) highScoreTime = currentScoreTime;
- if (currentScoreTime <= highScoreTurns) highScoreTurns = currentScoreTurns;
+ //if (currentScoreTime <= highScoreTime) highScoreTime = currentScoreTime;
+ //if (currentScoreTime <= highScoreTurns) highScoreTurns = currentScoreTurns;
int cubePairs = userInterface.getCubeCount();
if (cubePairs <= 0) {
userInterface.showMenu(currentScoreTime, highScoreTime, currentScoreTurns, highScoreTurns);
cubePairs = userInterface.getCubeCount();
+ // Startzeit speichern nach Enter
+ startTime = currentScoreTime;
}
std::vector positions =createCubes(cubePairs);
@@ -143,6 +148,12 @@ int main()
if (!gameWon)
gameWon = std::all_of(cubes.begin(), cubes.end(), [](const gamecube &c){ return c.IsMatched(); });
+ //Zeit Berechnung
+ if (!gameWon)
+ {
+ currentScoreTime = GetTime() - startTime;
+ DrawText(TextFormat("%.2f", currentScoreTime), 10, 30, 20, DARKGRAY);
+ }
// -----------------------------------------------------------
// Zeichnen
// -----------------------------------------------------------
@@ -163,14 +174,16 @@ int main()
//TODO: Neue Scores zuweisen, current genügen.
//currentScoreTime = 17.3;
//currentScoreTurns = 10;
- score.saveHighScore();
+
if (currentScoreTime <= highScoreTime) highScoreTime = currentScoreTime;
if (currentScoreTurns <= highScoreTurns) highScoreTurns = currentScoreTurns;
+ score.saveHighScore();
userInterface.showScore(currentScoreTime, highScoreTime, currentScoreTurns, highScoreTurns);
}
else
DrawText("Flip 2 cubes - find matching pairs!", 10, 10, 20, DARKGRAY);
+
EndDrawing();
}
diff --git a/userinterface.cpp b/userinterface.cpp
index 0ad27a6..446db27 100644
--- a/userinterface.cpp
+++ b/userinterface.cpp
@@ -32,6 +32,8 @@
if (!(std::atoi(textInput) > 10 || std::atoi(textInput) <= 1)) {
menuOpen = false;
cubeCount = std::atoi(textInput);
+
+ currentScoreTime = GetTime();
} else {
wrongInput = true;
}