X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FInterface.hpp;h=92d1c943705c8f9ecf83b74856aa0e193e75d756;hb=80a9a59d71a7b144c12f64cbef4644751bd54745;hp=88637c6adc368144b9825d411c03729b46cf9ba1;hpb=55dbd6b35a39888f245e247d2e140f141f918178;p=blank.git diff --git a/src/ui/Interface.hpp b/src/ui/Interface.hpp index 88637c6..92d1c94 100644 --- a/src/ui/Interface.hpp +++ b/src/ui/Interface.hpp @@ -1,13 +1,7 @@ #ifndef BLANK_UI_INTERFACE_HPP_ #define BLANK_UI_INTERFACE_HPP_ -#include "HUD.hpp" -#include "../app/FPSController.hpp" -#include "../app/IntervalTimer.hpp" -#include "../graphics/Font.hpp" -#include "../model/geometry.hpp" -#include "../model/OutlineModel.hpp" -#include "../world/Block.hpp" +#include "../app/Config.hpp" #include #include @@ -15,26 +9,19 @@ namespace blank { -class Chunk; -class BlendedSprite; -class DirectionalLighting; -class Assets; -class World; +struct ClientController; +class Keymap; +struct PlayerController; class Interface { public: - struct Config { - float move_velocity = 0.005f; - float pitch_sensitivity = -0.0025f; - float yaw_sensitivity = -0.001f; + Interface(Config &, const Keymap &, PlayerController &, ClientController &); - bool keyboard_disabled = false; - bool mouse_disabled = false; - bool visual_disabled = false; - }; + void SetInventorySlots(int num) { num_slots = num; } - Interface(const Config &, const Assets &, World &); + void Lock(); + void Unlock(); void HandlePress(const SDL_KeyboardEvent &); void HandleRelease(const SDL_KeyboardEvent &); @@ -42,56 +29,23 @@ public: void HandlePress(const SDL_MouseButtonEvent &); void HandleRelease(const SDL_MouseButtonEvent &); void Handle(const SDL_MouseWheelEvent &); - void Handle(const SDL_WindowEvent &) noexcept; - - void FaceBlock(); - void TurnBlock(); - - void ToggleCollision(); - - void PickBlock(); - void PlaceBlock(); - void RemoveBlock() noexcept; - - void PrintBlockInfo(); - void PrintChunkInfo(); - void PrintLightInfo(); - void PrintSelectionInfo(); - void Print(const Block &); - - void SelectNext(); - void SelectPrevious(); - - void Update(int dt); - - void Render(DirectionalLighting &, BlendedSprite &) noexcept; private: - void CheckAim(); + void UpdateMovement(); + void InvAbs(int slot); + void InvRel(int delta); private: - World &world; - FPSController ctrl; - Font font; - HUD hud; - - Ray aim; - Chunk *aim_chunk; - int aim_block; - glm::vec3 aim_normal; - - OutlineModel outline; - glm::mat4 outline_transform; - - Config config; - - IntervalTimer place_timer; - IntervalTimer remove_timer; + Config &config; + const Keymap &keymap; + PlayerController &player_ctrl; + ClientController &client_ctrl; - Block remove; - Block selection; + glm::ivec3 fwd, rev; + int slot; + int num_slots; - glm::tvec3 fwd, rev; + bool locked; };