]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/Interface.hpp
combine text handling stuff into a class
[blank.git] / src / ui / Interface.hpp
index 88637c6adc368144b9825d411c03729b46cf9ba1..d6c301981ef45125ac10cbf7a4eeabd7b987dbe6 100644 (file)
@@ -5,20 +5,20 @@
 #include "../app/FPSController.hpp"
 #include "../app/IntervalTimer.hpp"
 #include "../graphics/Font.hpp"
+#include "../graphics/Text.hpp"
 #include "../model/geometry.hpp"
 #include "../model/OutlineModel.hpp"
 #include "../world/Block.hpp"
 
-#include <SDL.h>
 #include <glm/glm.hpp>
 
 
 namespace blank {
 
-class Chunk;
-class BlendedSprite;
-class DirectionalLighting;
 class Assets;
+class Chunk;
+class FrameCounter;
+class Viewport;
 class World;
 
 class Interface {
@@ -34,7 +34,7 @@ public:
                bool visual_disabled = false;
        };
 
-       Interface(const Config &, const Assets &, World &);
+       Interface(const Config &, const Assets &, const FrameCounter &, World &);
 
        void HandlePress(const SDL_KeyboardEvent &);
        void HandleRelease(const SDL_KeyboardEvent &);
@@ -42,7 +42,6 @@ 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();
@@ -62,14 +61,18 @@ public:
        void SelectNext();
        void SelectPrevious();
 
+       void ToggleCounter();
+       void UpdateCounter();
+
        void Update(int dt);
 
-       void Render(DirectionalLighting &, BlendedSprite &) noexcept;
+       void Render(Viewport &) noexcept;
 
 private:
        void CheckAim();
 
 private:
+       const FrameCounter &counter;
        World &world;
        FPSController ctrl;
        Font font;
@@ -83,6 +86,8 @@ private:
        OutlineModel outline;
        glm::mat4 outline_transform;
 
+       Text counter_text;
+
        Config config;
 
        IntervalTimer place_timer;