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>
|
| | 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...
|
| |
| AudioManager * | getAudioManager () |
| | get the reference to the Audio manager More...
|
| |
| AnimationManager * | getAnimManager () |
| | 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...
|
| |
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.
◆ Client()
| Client::Client |
( |
boost::asio::io_service & |
io_service, |
|
|
GameConfig |
config |
|
) |
| |
Constructs a new Client object.
- Parameters
-
◆ ~Client()
◆ charCallback()
| void Client::charCallback |
( |
GLFWwindow * |
window, |
|
|
unsigned int |
codepoint |
|
) |
| |
◆ 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
-
◆ 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()
◆ 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()
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
-
| window | The GLFWwindow being monitered. |
| key | The key that is being pressed or released. |
| scancode | A unique platform-specific code for each key. |
| action | One of GLFW_PRESS, GLFW_REPEAT, or GLFW_RELEASE representing the state of the key. |
| mods | Any 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
-
| window | The GLFWwindow being monitered. |
| button | The mouse button pressed. |
| action | One of GLFW_PRESS, GLFW_REPEAT, or GLFW_RELEASE representing the state of the button. |
| mods | Any 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
-
| window | The GLFWwindow being monitered. |
| xposIn | The current x-coordinate of the cursor. |
| yposIn | The current y-coordinate of the cursor. |
◆ scrollCallback()
| void Client::scrollCallback |
( |
GLFWwindow * |
window, |
|
|
double |
xposIn, |
|
|
double |
yposIn |
|
) |
| |
Callback which handles scrolling movement.
- Parameters
-
| window | The GLFWwindow being monitered. |
| xposIn | The current scroll up value. |
| yposIn | The 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
-
| hover | boolean to indicate the DM is only hovering and has not placed yet |
| place | boolean to indicate the DM would like to place a type |
| trapType | ModelType 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
◆ gui::GUI
◆ curr_fps
The documentation for this class was generated from the following files: