blob: 0551f1c5ccd6a35f141924f9ff5b205b7c4dd7b2 (
plain) (
tree)
|
|
#pragma once
#include <nlohmann/json.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "World.hpp"
#include "NetworkClient.hpp"
#include "Vector.hpp"
#include "Event.hpp"
#include "Window.hpp"
class GameState {
std::mutex packetsMutex;
std::queue<std::shared_ptr<Packet>> packets;
public:
GameState() = default;
~GameState() = default;
void Update(float deltaTime);
void UpdatePacket(NetworkClient *nc);
enum Direction {
FORWARD, BACKWARD, LEFT, RIGHT, JUMP
};
void HandleMovement(GameState::Direction direction, float deltaTime);
void HandleRotation(double yaw, double pitch);
glm::mat4 GetViewMatrix();
Entity* player;
World world;
std::string g_PlayerUuid = "";
std::string g_PlayerName = "";
bool g_IsGameStarted = false;
int g_PlayerEid = 0;
int g_Gamemode = 0;
int g_Dimension = 0;
byte g_Difficulty = 0;
byte g_MaxPlayers = 0;
std::string g_LevelType = "";
bool g_ReducedDebugInfo = false;
Vector g_SpawnPosition;
bool g_PlayerInvulnerable = false;
bool g_PlayerFlying = false;
bool g_PlayerAllowFlying = false;
bool g_PlayerCreativeMode = false;
float g_PlayerFlyingSpeed = 0;
float g_PlayerFovModifier = 0;
float g_PlayerHealth = 0;
long long WorldAge = 0;
long long TimeOfDay = 0;
Window playerInventory;
std::vector<Window> openedWindows;
};
|