aboutsummaryrefslogtreecommitdiff
path: root/game/hud/HudSubScene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/hud/HudSubScene.cpp')
-rw-r--r--game/hud/HudSubScene.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/game/hud/HudSubScene.cpp b/game/hud/HudSubScene.cpp
new file mode 100644
index 0000000..e76623d
--- /dev/null
+++ b/game/hud/HudSubScene.cpp
@@ -0,0 +1,35 @@
+#include "HudSubScene.h"
+#include "api/GameObject.h"
+#include "api/Text.h"
+#include "../Config.h"
+#include "HudConfig.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_WIDTH,(DISTANCE_WIDTH/DISTANCE_LENGTH)*2};
+ hud_dis.add_component<Text>(size_distance, FONT,Text::Data{
+ .world_space = false,
+ .text_color = Color::WHITE,
+ }, TOP_LEFT+FONTOFFSET, DISTANCE_PLACEHOLDER);
+
+ // Best
+ GameObject hud_best = scn.new_object(HUD_BEST);
+ crepe::vec2 size_best = {BEST_WIDTH,(BEST_WIDTH/BEST_LENGTH)*2};
+ hud_best.add_component<Text>(size_best, FONT,Text::Data{
+ .world_space = false,
+ .text_color = Color::WHITE,
+ }, TOP_LEFT+FONTOFFSET+BEST_OFFSET, BEST);
+
+ // Coins
+ GameObject hud_coin = scn.new_object(HUD_COINS);
+ crepe::vec2 size = {COINS_WIDTH,(COINS_WIDTH/COINS_LENGTH)*2};
+ hud_coin.add_component<Text>(size, FONT,Text::Data{
+ .world_space = false,
+ .text_color = Color::WHITE,
+ }, TOP_LEFT+FONTOFFSET+COINS_OFFSET, COINS);
+}