X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FHUD.hpp;h=cbe28762727c81e90c47f973298bce545f3a6393;hb=dcd54cacda98c2c0f7cf0c7a9131fb858d8ee10a;hp=ca6b7544a54ee9a15f7639bb2e1f6fba65376724;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/ui/HUD.hpp b/src/ui/HUD.hpp index ca6b754..cbe2876 100644 --- a/src/ui/HUD.hpp +++ b/src/ui/HUD.hpp @@ -1,47 +1,100 @@ #ifndef BLANK_UI_HUD_H_ #define BLANK_UI_HUD_H_ -#include "../model/Model.hpp" -#include "../model/OutlineModel.hpp" - -#include +#include "FixedText.hpp" +#include "MessageBox.hpp" +#include "../graphics/EntityMesh.hpp" +#include "../graphics/glm.hpp" +#include "../graphics/PrimitiveMesh.hpp" namespace blank { class Block; class BlockTypeRegistry; -class DirectionalLighting; +class Config; +class CongestionControl; +class Environment; +class Font; +class Player; +class Viewport; class HUD { public: - explicit HUD(const BlockTypeRegistry &); + explicit HUD(Environment &, Config &, const Player &); HUD(const HUD &) = delete; HUD &operator =(const HUD &) = delete; - void Viewport(float width, float height) noexcept; - void Viewport(float x, float y, float width, float height) noexcept; + // focus + void FocusBlock(const Chunk &, int); + void FocusEntity(const Entity &); + void FocusNone(); - void Display(const Block &); + // "inventory" + void DisplayNone(); + void Display(const BlockType &); - void Render(DirectionalLighting &) noexcept; + // debug overlay + void UpdateDebug(); + void UpdateCounter(); + void UpdatePosition(); + void UpdateOrientation(); -private: - const BlockTypeRegistry &types; + // net stats + void UpdateNetStats(const CongestionControl &); + + // message box + void PostMessage(const char *); + void PostMessage(const std::string &msg) { + PostMessage(msg.c_str()); + } + // whether to always render message box regardless of last post + void KeepMessages(bool k) { msg_keep = k; } - Model block; - Model::Buffer block_buf; + 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; - glm::mat4 crosshair_transform; - - float near, far; - glm::mat4 projection; - glm::mat4 view; + // debug overlay + FixedText counter_text; + FixedText position_text; + FixedText orientation_text; + FixedText block_text; + FixedText entity_text; + bool show_block; + bool show_entity; + + // net stats + FixedText bandwidth_text; + FixedText rtt_text; + FixedText packet_loss_text; + bool show_net; + + // message box + MessageBox messages; + CoarseTimer msg_timer; + bool msg_keep; + + // crosshair + PrimitiveMesh crosshair; };