6#include <unordered_map>
10#include <boost/asio/ip/tcp.hpp>
11#include <boost/asio/io_service.hpp>
12#include <boost/filesystem.hpp>
34#define WINDOW_WIDTH Client::getWindowSize().x
35#define WINDOW_HEIGHT Client::getWindowSize().y
40#define FRAC_WINDOW_WIDTH(num, denom) Client::window_width * static_cast<float>(num) / static_cast<float>(denom)
41#define FRAC_WINDOW_HEIGHT(num, denom) Client::window_height * static_cast<float>(num) / static_cast<float>(denom)
43using namespace boost::asio::ip;
109 void keyCallback(GLFWwindow *window,
int key,
int scancode,
int action,
int mods);
118 void mouseCallback(GLFWwindow* window,
double xposIn,
double yposIn);
127 void scrollCallback(GLFWwindow* window,
double xposIn,
double yposIn);
145 void charCallback(GLFWwindow* window,
unsigned int codepoint);
174 bool connect(std::string ip_addr);
210 void processServerInput(
bool allow_defer);
213 GLuint gPosition, gNormal, gAlbedoSpec;
219 void configureGBuffer();
243 void drawBbox(boost::optional<SharedObject>
object);
249 std::optional<LoadIntroCutsceneEvent> intro_cutscene;
252 std::shared_ptr<Shader> deferred_geometry_shader;
253 std::shared_ptr<Shader> deferred_lighting_shader;
254 std::shared_ptr<Shader> dm_deferred_lighting_shader;
255 std::shared_ptr<Shader> deferred_light_box_shader;
258 std::unique_ptr<Model> fire_player_model;
259 std::unique_ptr<Model> lightning_player_model;
260 std::unique_ptr<Model> water_player_model;
262 std::unique_ptr<Model> bear_model;
263 std::unique_ptr<Model> torchlight_model;
264 std::unique_ptr<Model> torchpost_model;
265 std::unique_ptr<Model> wall_model;
266 std::unique_ptr<Model> pillar_model;
267 std::unique_ptr<Model> sungod_model;
268 std::unique_ptr<Model> slime_model;
269 std::unique_ptr<Model> python_model;
270 std::unique_ptr<Model> item_model;
271 std::unique_ptr<Model> spike_trap_model;
272 std::unique_ptr<Model> orb_model;
273 std::unique_ptr<Model> exit_model;
274 std::unique_ptr<Model> floor_model;
275 std::unique_ptr<Model> arrow_model;
276 std::unique_ptr<Model> arrow_trap_model;
277 std::unique_ptr<Model> lava_cross_model;
278 std::unique_ptr<Model> lava_vertical_model;
279 std::unique_ptr<Model> lava_horizontal_model;
280 std::unique_ptr<Model> lightning_model;
281 std::unique_ptr<Model> chest_model;
282 std::unique_ptr<Model> teleport_model;
283 std::unique_ptr<Model> mirror_model;
296 enum class LobbyPlayerState {
306 LobbyPlayerState lobbyPlayerState;
312 enum class RadioButtonState {
322 RadioButtonState roleSelection;
332 std::unique_ptr<Camera> cam;
335 static int window_width;
336 static int window_height;
338 static time_t time_of_last_keystroke;
341 bool is_held_up =
false;
342 bool is_held_down =
false;
343 bool is_held_right =
false;
344 bool is_held_left =
false;
345 bool is_held_space =
false;
348 bool is_held_i =
false;
349 bool is_held_o =
false;
351 bool is_left_mouse_down =
false;
352 bool is_right_mouse_down =
false;
358 float mouse_xpos = 0.0f;
359 float mouse_ypos = 0.0f;
361 double lastTime = 0.0;
362 double lastFrameTime = 0.0;
365 tcp::resolver resolver;
371 basic_resolver_results<class boost::asio::ip::tcp> endpoints;
372 std::shared_ptr<Session> session;
376 std::array<boost::optional<SharedObject>,
MAX_POINT_LIGHTS> closest_light_sources;
378 std::deque<Event> events_received;
Definition: animationmanager.hpp:19
Definition: audiomanager.hpp:15
A clsas that represents the client for the game. Contains all local information, including the Shared...
Definition: client.hpp:50
AnimationManager * getAnimManager()
get the reference to the Animation manager
Definition: client.hpp:184
static time_t getTimeOfLastKeystroke()
Get the time of last keystroke.
Definition: client.cpp:1879
int curr_fps
Definition: client.hpp:200
static glm::vec2 getWindowSize()
Get a vec2 representing <width, height> of the window size.
Definition: client.cpp:1875
GLFWwindow * getWindow()
Returns a pointer to the GLFWwindow object.
Definition: client.hpp:167
void sendPacketsToServer()
sends all queued packets to server
void charCallback(GLFWwindow *window, unsigned int codepoint)
Definition: client.cpp:1870
void displayCallback()
Display callback which handles the rendering of all local objects. Abstracts the logic of the main re...
Definition: client.cpp:341
~Client()
Destroys the Client object.
Definition: client.cpp:126
void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
Callback which handles keyboard inputs to the GLFWwindow. Binds to the GLFWwindow.
Definition: client.cpp:1538
void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods)
Callback which handles mouse button presses.
Definition: client.cpp:1828
bool init()
Initializes glfw, glew, shaders, and the GLFWwindow.
Definition: client.cpp:129
bool connect(std::string ip_addr)
Creates and connects to a Session at the specified IP address.
Definition: client.cpp:104
void setWorldPos()
the current position in the world the player is looking at
Definition: client.cpp:1810
AudioManager * getAudioManager()
get the reference to the Audio manager
Definition: client.cpp:100
void scrollCallback(GLFWwindow *window, double xposIn, double yposIn)
Callback which handles scrolling movement.
Definition: client.cpp:1751
bool cleanup()
Frees all pointers, deletes the GLFWwindow, and terminates glfw.
Definition: client.cpp:328
void mouseCallback(GLFWwindow *window, double xposIn, double yposIn)
Callback which handles mouse cursor movement. Does not include mouse button presses.
Definition: client.cpp:1799
void idleCallback()
Callback which handles all updates to the local SharedGameState, and sends events to the server based...
Definition: client.cpp:430
void sendTrapEvent(bool hover, bool place, ModelType trapType)
Send down a trap event to the server.
Definition: client.cpp:376
Definition: lobbyfinder.hpp:23
unsigned int GLuint
Definition: glad.h:115
GUIState
Definition: gui.hpp:39
#define MAX_POINT_LIGHTS
Definition: constants.hpp:7
ModelType
Enumeration of every render model in the game.
Definition: sharedmodel.hpp:6
Definition: config.hpp:12
The SharedGameState is a representation of the ServerGameState instance maintained by the server and ...
Definition: sharedgamestate.hpp:167
uint32_t EntityID
Global Object ID (when the server or client references an object with a particular EntityID,...
Definition: typedefs.hpp:9