aboutsummaryrefslogtreecommitdiff
path: root/game/hud/HudSubScene.cpp
diff options
context:
space:
mode:
authorJaro <59013720+JaroWMR@users.noreply.github.com>2025-01-08 09:31:14 +0100
committerGitHub <noreply@github.com>2025-01-08 09:31:14 +0100
commite75ca1c947f3cde19bebf15049732bc069c6e913 (patch)
treecdaa7a2c06ffc7f41366d4106e16f254e3b9cdc5 /game/hud/HudSubScene.cpp
parentf31bd86ae5d7df21b788a273d4f2e530136ec184 (diff)
parent0d087f23affbdf5bcfb238bc9b9d3fc05b314c44 (diff)
Merge pull request #101 from lonkaars/jaro/main-menu
Jaro/main menu
Diffstat (limited to 'game/hud/HudSubScene.cpp')
-rw-r--r--game/hud/HudSubScene.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/game/hud/HudSubScene.cpp b/game/hud/HudSubScene.cpp
new file mode 100644
index 0000000..ca81614
--- /dev/null
+++ b/game/hud/HudSubScene.cpp
@@ -0,0 +1,68 @@
+#include "HudSubScene.h"
+#include "HudConfig.h"
+
+#include "../Config.h"
+
+#include <crepe/api/GameObject.h>
+#include <crepe/api/Text.h>
+
+using namespace crepe;
+using namespace std;
+
+void HudSubScene::create(Scene & scn) {
+
+ // Distance
+ GameObject hud_dis = scn.new_object(HUD_DISTANCE);
+
+ crepe::vec2 size_distance
+ = {DISTANCE_CHAR_WIDTH * DISTANCE_LENGTH, (DISTANCE_CHAR_WIDTH) * 2};
+ hud_dis.add_component<Text>(
+ size_distance, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ TOP_LEFT + FONTOFFSET + vec2 {DISTANCE_LENGTH * DISTANCE_CHAR_WIDTH / 2, 0},
+ DISTANCE_PLACEHOLDER
+ );
+
+ // Best
+ GameObject hud_best = scn.new_object(HUD_BEST);
+ crepe::vec2 size_best = {BEST_CHAR_WIDTH * BEST_LENGTH, (BEST_CHAR_WIDTH) * 2};
+ hud_best.add_component<Text>(
+ size_best, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::GREY,
+ },
+ TOP_LEFT + FONTOFFSET + BEST_OFFSET + vec2 {BEST_LENGTH * BEST_CHAR_WIDTH / 2, 0}, BEST
+ );
+
+ // Coins
+ GameObject hud_coin = scn.new_object(HUD_COINS);
+ crepe::vec2 size_coin = {COINS_CHAR_WIDTH * COINS_LENGTH, (COINS_CHAR_WIDTH) * 2};
+ hud_coin.add_component<Text>(
+ size_coin, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::YELLOW,
+ },
+ TOP_LEFT + FONTOFFSET + COINS_OFFSET + vec2 {COINS_LENGTH * COINS_CHAR_WIDTH / 2, 0},
+ COINS
+ );
+
+ // Fps
+ GameObject hud_fps = scn.new_object(HUD_FPS);
+ crepe::vec2 size_fps = {FPS_CHAR_WIDTH * FPS_LENGTH, (FPS_CHAR_WIDTH) * 2};
+ hud_fps
+ .add_component<Text>(
+ size_fps, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::GREEN,
+ },
+ TOP_LEFT + FONTOFFSET + FPS_OFFSET + vec2 {FPS_LENGTH * FPS_CHAR_WIDTH / 2, 0}, FPS
+ )
+ .active
+ = false;
+}