Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Data Fields | Friends
Client Class Reference

A clsas that represents the client for the game. Contains all local information, including the SharedGameState, as well as callbacks for rendering objects and initializing glfw, glew, shaders, and windows. More...

#include <client.hpp>

Public Member Functions

 Client (boost::asio::io_service &io_service, GameConfig config)
 Constructs a new Client object. More...
 
 ~Client ()
 Destroys the Client object. More...
 
bool init ()
 Initializes glfw, glew, shaders, and the GLFWwindow. More...
 
bool cleanup ()
 Frees all pointers, deletes the GLFWwindow, and terminates glfw. More...
 
void displayCallback ()
 Display callback which handles the rendering of all local objects. Abstracts the logic of the main render loop. All logic relating to rendering and any glfw or OpenGL calls should go in here. More...
 
void idleCallback ()
 Callback which handles all updates to the local SharedGameState, and sends events to the server based on any local inputs. All logic relating to state updates shoud go in here. More...
 
void sendPacketsToServer ()
 sends all queued packets to server More...
 
void keyCallback (GLFWwindow *window, int key, int scancode, int action, int mods)
 Callback which handles keyboard inputs to the GLFWwindow. Binds to the GLFWwindow. More...
 
void mouseCallback (GLFWwindow *window, double xposIn, double yposIn)
 Callback which handles mouse cursor movement. Does not include mouse button presses. More...
 
void scrollCallback (GLFWwindow *window, double xposIn, double yposIn)
 Callback which handles scrolling movement. More...
 
void mouseButtonCallback (GLFWwindow *window, int button, int action, int mods)
 Callback which handles mouse button presses. More...
 
void charCallback (GLFWwindow *window, unsigned int codepoint)
 
GLFWwindow * getWindow ()
 Returns a pointer to the GLFWwindow object. More...
 
bool connect (std::string ip_addr)
 Creates and connects to a Session at the specified IP address. More...
 
AudioManagergetAudioManager ()
 get the reference to the Audio manager More...
 
AnimationManagergetAnimManager ()
 get the reference to the Animation manager More...
 
void setWorldPos ()
 the current position in the world the player is looking at More...
 
void sendTrapEvent (bool hover, bool place, ModelType trapType)
 Send down a trap event to the server. More...
 

Static Public Member Functions

static glm::vec2 getWindowSize ()
 Get a vec2 representing <width, height> of the window size. More...
 
static time_t getTimeOfLastKeystroke ()
 Get the time of last keystroke. More...
 

Data Fields

int curr_fps
 

Friends

class gui::GUI
 

Detailed Description

A clsas that represents the client for the game. Contains all local information, including the SharedGameState, as well as callbacks for rendering objects and initializing glfw, glew, shaders, and windows.

Constructor & Destructor Documentation

◆ Client()

Client::Client ( boost::asio::io_service &  io_service,
GameConfig  config 
)

Constructs a new Client object.

Parameters
io_service
config

◆ ~Client()

Client::~Client ( )

Destroys the Client object.

Member Function Documentation

◆ charCallback()

void Client::charCallback ( GLFWwindow *  window,
unsigned int  codepoint 
)
Parameters
window
codepoint

◆ cleanup()

bool Client::cleanup ( )

Frees all pointers, deletes the GLFWwindow, and terminates glfw.

Returns
true if all objects were cleaned up correclty, false otherwise

◆ connect()

bool Client::connect ( std::string  ip_addr)

Creates and connects to a Session at the specified IP address.

Parameters
ip_addr

◆ displayCallback()

void Client::displayCallback ( )

Display callback which handles the rendering of all local objects. Abstracts the logic of the main render loop. All logic relating to rendering and any glfw or OpenGL calls should go in here.

◆ getAnimManager()

AnimationManager * Client::getAnimManager ( )
inline

get the reference to the Animation manager

◆ getAudioManager()

AudioManager * Client::getAudioManager ( )

get the reference to the Audio manager

◆ getTimeOfLastKeystroke()

time_t Client::getTimeOfLastKeystroke ( )
static

Get the time of last keystroke.

Returns
time_t

◆ getWindow()

GLFWwindow * Client::getWindow ( )
inline

Returns a pointer to the GLFWwindow object.

Returns
GLFWwindow* The GLFWwindow being used in the Client.

◆ getWindowSize()

glm::vec2 Client::getWindowSize ( )
static

Get a vec2 representing <width, height> of the window size.

Returns
glm::vec2

◆ idleCallback()

void Client::idleCallback ( )

Callback which handles all updates to the local SharedGameState, and sends events to the server based on any local inputs. All logic relating to state updates shoud go in here.

◆ init()

bool Client::init ( )

Initializes glfw, glew, shaders, and the GLFWwindow.

Returns
true if all libraries and objects were initialized correctly, false otherwise

◆ keyCallback()

void Client::keyCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)

Callback which handles keyboard inputs to the GLFWwindow. Binds to the GLFWwindow.

Parameters
windowThe GLFWwindow being monitered.
keyThe key that is being pressed or released.
scancodeA unique platform-specific code for each key.
actionOne of GLFW_PRESS, GLFW_REPEAT, or GLFW_RELEASE representing the state of the key.
modsAny modifiers to the key pressed (i.e. shift, ctrl, alt, etc.).

◆ mouseButtonCallback()

void Client::mouseButtonCallback ( GLFWwindow *  window,
int  button,
int  action,
int  mods 
)

Callback which handles mouse button presses.

Parameters
windowThe GLFWwindow being monitered.
buttonThe mouse button pressed.
actionOne of GLFW_PRESS, GLFW_REPEAT, or GLFW_RELEASE representing the state of the button.
modsAny modifiers to the key pressed (i.e. shift, ctrl, alt, etc.).

◆ mouseCallback()

void Client::mouseCallback ( GLFWwindow *  window,
double  xposIn,
double  yposIn 
)

Callback which handles mouse cursor movement. Does not include mouse button presses.

Parameters
windowThe GLFWwindow being monitered.
xposInThe current x-coordinate of the cursor.
yposInThe current y-coordinate of the cursor.

◆ scrollCallback()

void Client::scrollCallback ( GLFWwindow *  window,
double  xposIn,
double  yposIn 
)

Callback which handles scrolling movement.

Parameters
windowThe GLFWwindow being monitered.
xposInThe current scroll up value.
yposInThe current scroll down value.

◆ sendPacketsToServer()

void Client::sendPacketsToServer ( )

sends all queued packets to server

◆ sendTrapEvent()

void Client::sendTrapEvent ( bool  hover,
bool  place,
ModelType  trapType 
)

Send down a trap event to the server.

Parameters
hoverboolean to indicate the DM is only hovering and has not placed yet
placeboolean to indicate the DM would like to place a type
trapTypeModelType to indicate the type of the trap the DM wants to place

◆ setWorldPos()

void Client::setWorldPos ( )

the current position in the world the player is looking at

Friends And Related Function Documentation

◆ gui::GUI

friend class gui::GUI
friend

Field Documentation

◆ curr_fps

int Client::curr_fps

The documentation for this class was generated from the following files: