aboutsummaryrefslogtreecommitdiff
path: root/game/menus/endgame
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 14:43:42 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 14:43:42 +0100
commitd1cebcca2018ed4ef47ad125e45aafd018a2ab2e (patch)
tree8f4881cf4abc58774625383620cf82fa55b9d1f0 /game/menus/endgame
parent938b6a7bb62459e8308320280d15ccaf1b8af0ac (diff)
make format
Diffstat (limited to 'game/menus/endgame')
-rw-r--r--game/menus/endgame/EndGameSubScene.cpp21
-rw-r--r--game/menus/endgame/EndGameSubScript.cpp26
2 files changed, 28 insertions, 19 deletions
diff --git a/game/menus/endgame/EndGameSubScene.cpp b/game/menus/endgame/EndGameSubScene.cpp
index 0b72bdc..b33072a 100644
--- a/game/menus/endgame/EndGameSubScene.cpp
+++ b/game/menus/endgame/EndGameSubScene.cpp
@@ -73,21 +73,24 @@ void EndGameSubScene::create(Scene & scn) {
.world_space = false,
.text_color = Color::WHITE,
},
- vec2 {0, Y_SPACING+Y_OFFSET} + FONTOFFSET, DISTANCE_STRING
+ vec2 {0, Y_SPACING + Y_OFFSET} + FONTOFFSET, DISTANCE_STRING
);
// Highscore
const string HIGHSCORE_STRING = "NEW HIGHSCORE";
GameObject highscore = scn.new_object("highscore_endgame", "highscore_tag_end");
crepe::vec2 size_highscore = {200, (200.0f / HIGHSCORE_STRING.size()) * 2};
- highscore.add_component<Text>(
- size_highscore, FONT,
- Text::Data {
- .world_space = false,
- .text_color = Color::WHITE,
- },
- vec2 {0, Y_SPACING*2+Y_OFFSET} + FONTOFFSET, HIGHSCORE_STRING
- ).active = false;
+ highscore
+ .add_component<Text>(
+ size_highscore, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {0, Y_SPACING * 2 + Y_OFFSET} + FONTOFFSET, HIGHSCORE_STRING
+ )
+ .active
+ = false;
// Buttons
vec2 button_position = {190, 190};
diff --git a/game/menus/endgame/EndGameSubScript.cpp b/game/menus/endgame/EndGameSubScript.cpp
index e081350..6793f3e 100644
--- a/game/menus/endgame/EndGameSubScript.cpp
+++ b/game/menus/endgame/EndGameSubScript.cpp
@@ -1,9 +1,9 @@
#include "EndGameSubScript.h"
+#include "../../Config.h"
#include "../../Events.h"
#include "../ButtonReplaySubScript.h"
#include "../IFloatingWindowScript.h"
-#include "../../Config.h"
#include "ValueBroker.h"
#include "manager/SaveManager.h"
@@ -60,11 +60,13 @@ bool EndGameSubScript::reset_timescale() {
return false;
}
-bool EndGameSubScript::showscore(){
- // Gather text
+bool EndGameSubScript::showscore() {
+ // Gather text
Text & coins_text = this->get_components_by_name<Text>("gold_endgame").front().get();
- Text & distance_text = this->get_components_by_name<Text>("distance_endgame").front().get();
- Text & highscore_text = this->get_components_by_name<Text>("highscore_endgame").front().get();
+ Text & distance_text
+ = this->get_components_by_name<Text>("distance_endgame").front().get();
+ Text & highscore_text
+ = this->get_components_by_name<Text>("highscore_endgame").front().get();
highscore_text.active = false;
// Gather saved data
@@ -75,20 +77,24 @@ bool EndGameSubScript::showscore(){
int distance_game = savemgr.get<int>(DISTANCE_GAME, 0).get();
// Show highscore
- if(distance_run > distance_game) highscore_text.active = true;
+ if (distance_run > distance_game) highscore_text.active = true;
const float CHAR_SIZE_DIS = 20;
// Show distance
- std::string distance_string = "DISTANCE:" + distance.get();
+ std::string distance_string = "DISTANCE:" + distance.get();
distance_text.text = distance_string;
- crepe::vec2 size_distance = {CHAR_SIZE_DIS*distance_string.size(), (CHAR_SIZE_DIS*distance_string.size() / distance_string.size()) * 2};
+ crepe::vec2 size_distance
+ = {CHAR_SIZE_DIS * distance_string.size(),
+ (CHAR_SIZE_DIS * distance_string.size() / distance_string.size()) * 2};
distance_text.dimensions = size_distance;
const float CHAR_SIZE_COIN = 16;
// Show coins
- std::string coins_string = "Coins:" + coins.get();
+ std::string coins_string = "Coins:" + coins.get();
coins_text.text = coins_string;
- crepe::vec2 size_coins = {CHAR_SIZE_COIN*coins_string.size(), (CHAR_SIZE_COIN*coins_string.size() / coins_string.size()) * 2};
+ crepe::vec2 size_coins
+ = {CHAR_SIZE_COIN * coins_string.size(),
+ (CHAR_SIZE_COIN * coins_string.size() / coins_string.size()) * 2};
coins_text.dimensions = size_coins;
return false;