#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 <SDL.h>
#include <glm/glm.hpp>
namespace blank {
-class Assets;
-class Chunk;
-class BlendedSprite;
-class DirectionalLighting;
-class FrameCounter;
-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 &, const FrameCounter &, World &);
+ void Lock();
+ void Unlock();
void HandlePress(const SDL_KeyboardEvent &);
void HandleRelease(const SDL_KeyboardEvent &);
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 ToggleCounter();
- void UpdateCounter();
-
- void Update(int dt);
-
- void Render(DirectionalLighting &, BlendedSprite &) noexcept;
private:
- void CheckAim();
+ void UpdateMovement();
+ void InvAbs(int slot);
+ void InvRel(int delta);
private:
- const FrameCounter &counter;
- 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;
-
- bool show_counter;
- Texture counter_tex;
- SpriteModel counter_sprite;
- glm::mat4 counter_transform;
- SDL_Color counter_color;
-
- 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<int> fwd, rev;
+ bool locked;
};