diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 14:26:19 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-05 14:26:19 +0100 |
commit | ba170d00586ab261e015cc2febbb43f9aa7ae43e (patch) | |
tree | 4b902f20aa0b10a3ac04ec2c03f46ec3449558d1 /game/hud/HudSubScene.cpp | |
parent | 5ae4e3f0e3ff1d111eaea54b7b0a0788203d9d72 (diff) |
added hud
Diffstat (limited to 'game/hud/HudSubScene.cpp')
-rw-r--r-- | game/hud/HudSubScene.cpp | 35 |
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); +} |