X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FInterface.hpp;h=aab8b156596e5cdf42ba691bb8cbe8a381c46dc4;hb=dbfcb12348b80e2582f710acb1e4ed0011889ba2;hp=0cffd762cc29ea79af24b2204a94f0d4299c9e29;hpb=5cd73a8f2b40e59ec13aa2a6af33bc8e2a6b9a6c;p=blank.git diff --git a/src/ui/Interface.hpp b/src/ui/Interface.hpp index 0cffd76..aab8b15 100644 --- a/src/ui/Interface.hpp +++ b/src/ui/Interface.hpp @@ -10,6 +10,8 @@ #include "../model/geometry.hpp" #include "../model/OutlineModel.hpp" #include "../world/Block.hpp" +#include "../world/EntityCollision.hpp" +#include "../world/WorldCollision.hpp" #include #include @@ -18,7 +20,6 @@ namespace blank { -class Chunk; class Environment; class Viewport; class World; @@ -27,6 +28,8 @@ class Interface { public: struct Config { + std::string player_name = "default"; + float move_velocity = 0.005f; float pitch_sensitivity = -0.0025f; float yaw_sensitivity = -0.001f; @@ -39,6 +42,9 @@ public: Interface(const Config &, Environment &, World &); + Entity &Player() noexcept { return ctrl.Controlled(); } + const Entity &Player() const noexcept { return ctrl.Controlled(); } + void HandlePress(const SDL_KeyboardEvent &); void HandleRelease(const SDL_KeyboardEvent &); void Handle(const SDL_MouseMotionEvent &); @@ -55,12 +61,6 @@ public: void PlaceBlock(); void RemoveBlock() noexcept; - void PrintBlockInfo(); - void PrintChunkInfo(); - void PrintLightInfo(); - void PrintSelectionInfo(); - void Print(const Block &); - void SelectNext(); void SelectPrevious(); @@ -70,6 +70,9 @@ public: void ToggleDebug(); void UpdateCounter(); void UpdatePosition(); + void UpdateOrientation(); + void UpdateBlockInfo(); + void UpdateEntityInfo(); void PostMessage(const char *); void PostMessage(const std::string &msg) { @@ -82,6 +85,7 @@ public: private: void CheckAim(); + void UpdateOutline(); private: Environment &env; @@ -90,15 +94,19 @@ private: HUD hud; Ray aim; - Chunk *aim_chunk; - int aim_block; - glm::vec3 aim_normal; + WorldCollision aim_world; + EntityCollision aim_entity; OutlineModel outline; glm::mat4 outline_transform; FixedText counter_text; FixedText position_text; + FixedText orientation_text; + FixedText block_text; + FixedText entity_text; + Block last_block; + Entity *last_entity; MessageBox messages; IntervalTimer msg_timer; @@ -115,6 +123,8 @@ private: glm::ivec3 fwd, rev; + bool debug; + }; }