]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/HUD.hpp
renamed OutlineMesh -> PrimitiveMesh
[blank.git] / src / ui / HUD.hpp
index 55f3afb806cb56d73a01f27d881a0adb8d76816a..cab8f93e0bf13c26cccb69a6a3a4d48b6ac28fa9 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef BLANK_UI_HUD_H_
 #define BLANK_UI_HUD_H_
 
-#include "../graphics/Texture.hpp"
-#include "../model/Model.hpp"
-#include "../model/OutlineModel.hpp"
-#include "../model/SpriteModel.hpp"
+#include "FixedText.hpp"
+#include "MessageBox.hpp"
+#include "../graphics/EntityMesh.hpp"
+#include "../graphics/PrimitiveMesh.hpp"
 
 #include <glm/glm.hpp>
 
@@ -13,36 +13,76 @@ namespace blank {
 
 class Block;
 class BlockTypeRegistry;
+class Config;
+class Environment;
 class Font;
+class Player;
 class Viewport;
 
 class HUD {
 
 public:
-       HUD(const BlockTypeRegistry &, const Font &);
+       explicit HUD(Environment &, Config &, const Player &);
 
        HUD(const HUD &) = delete;
        HUD &operator =(const HUD &) = delete;
 
-       void Display(const Block &);
+       // focus
+       void FocusBlock(const Chunk &, int);
+       void FocusEntity(const Entity &);
+       void FocusNone();
 
-       void Render(Viewport &) noexcept;
+       // "inventory"
+       void DisplayNone();
+       void Display(const BlockType &);
 
-private:
-       const BlockTypeRegistry &types;
-       const Font &font;
+       // debug overlay
+       void UpdateDebug();
+       void UpdateCounter();
+       void UpdatePosition();
+       void UpdateOrientation();
 
-       Model block;
-       Model::Buffer block_buf;
-       glm::mat4 block_transform;
+       // message box
+       void PostMessage(const char *);
+       void PostMessage(const std::string &msg) {
+               PostMessage(msg.c_str());
+       }
 
-       Texture block_label;
-       SpriteModel label_sprite;
-       glm::mat4 label_transform;
+       void Update(int dt);
+       void Render(Viewport &) noexcept;
 
+private:
+       Environment &env;
+       Config &config;
+       const Player &player;
+
+       // block focus
+       PrimitiveMesh outline;
+       glm::mat4 outline_transform;
+       bool outline_visible;
+
+       // "inventory"
+       EntityMesh block;
+       EntityMesh::Buffer block_buf;
+       glm::mat4 block_transform;
+       FixedText block_label;
        bool block_visible;
 
-       OutlineModel crosshair;
+       // debug overlay
+       FixedText counter_text;
+       FixedText position_text;
+       FixedText orientation_text;
+       FixedText block_text;
+       FixedText entity_text;
+       bool show_block;
+       bool show_entity;
+
+       // message box
+       MessageBox messages;
+       IntervalTimer msg_timer;
+
+       // crosshair
+       PrimitiveMesh crosshair;
 
 };