aboutsummaryrefslogtreecommitdiff
path: root/game/hud/HudSubScene.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-01-11 21:32:30 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2025-01-11 21:32:30 +0100
commita6803980f1e74ecf1abb007b7c77f00d2cd92c43 (patch)
tree425ca961b27117d6e5d5fa0ae5cfca93351e0b33 /game/hud/HudSubScene.cpp
parent6bc0025e4c24ed6659d993f3469c10615fb0e273 (diff)
parent525636bb2158ecea68ebb9d6b8d2dc722524c5e5 (diff)
merge master into loek/doxygen
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..dcc07b4
--- /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::GOLD,
+ },
+ 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;
+}