25#include <boost/optional/optional.hpp>
52#define GUI_PROJECTION_MATRIX() glm::ortho(0.0f, (float)WINDOW_WIDTH, 0.0f, (float)WINDOW_HEIGHT);
138 void handleInputs(
float mouse_xpos,
float mouse_ypos,
bool& is_left_mouse_down,
bool& is_right_mouse_down);
203 template <
typename W>
205 for (
const auto& [_, widget] : this->widgets) {
206 if (widget->hasHandle(handle)) {
207 return dynamic_cast<W*
>(widget->borrow(handle));
211 std::cerr <<
"GUI ERROR: attempting to borrowWidget from GUI\n"
212 <<
"with invalid handle. This should never happen\n"
213 <<
"and means we are doing something very very bad." << std::endl;
288 std::shared_ptr<font::Loader>
getFonts();
293 std::map<widget::Handle, widget::Widget::Ptr> widgets;
295 std::shared_ptr<font::Loader> fonts;
298 bool capture_keystrokes;
299 std::string keyboard_input;
304 bool controlDisplayed;
306 std::vector<std::string> recentEvents;
319 void _handleClick(
float x,
float y);
328 void _handleHover(
float x,
float y);
346 void _layoutLoadingScreen();
352 void _layoutTitleScreen();
359 void _layoutLobbyBrowser();
364 void _layoutFPSCounter();
387 glm::vec3 columnWidths, glm::vec2 origin,
int playerIndex);
393 void _layoutGameHUD();
398 void _sharedGameHUD();
407 void _layoutGameEscMenu();
411 void _layoutDeadScreen();
417 void _layoutResultsScreen();
A clsas that represents the client for the game. Contains all local information, including the Shared...
Definition: client.hpp:50
void renderFrame()
Definition: gui.cpp:67
bool init()
Initializes all of the necessary file loading for all of the GUI elements, and registers all of the s...
Definition: gui.cpp:23
widget::Widget::Ptr removeWidget(widget::Handle handle)
Removes the specified widget from the GUI.
Definition: gui.cpp:100
void handleInputs(float mouse_xpos, float mouse_ypos, bool &is_left_mouse_down, bool &is_right_mouse_down)
Takes the current relevant input information and alters the GUI based on the how the inputs interact ...
Definition: gui.cpp:81
widget::Handle addWidget(widget::Widget::Ptr &&widget)
==============================================================================
Definition: gui.cpp:94
void beginFrame()
================================================================================
Definition: gui.cpp:62
void setCaptureKeystrokes(bool should_capture)
Toggles whether or not the GUI should be capturing keyboard input.
Definition: gui.cpp:130
void captureBackspace()
If the GUI is capturing backspaces, then records a backspace press. This deletes the most recently ca...
Definition: gui.cpp:106
void clearCapturedKeyboardInput()
Wipes all of the captured keyboard input from the internal state.
Definition: gui.cpp:134
W * borrowWidget(widget::Handle handle)
Borrows the specified widget from the GUI. This is especially useful inside of callback functions for...
Definition: gui.hpp:204
void captureKeystroke(char c)
Captures a keystroke as an ASCII char.
Definition: gui.cpp:114
bool shouldCaptureKeystrokes() const
==============================================================================
Definition: gui.cpp:126
void displayControl()
Displays controls for the player.
Definition: gui.cpp:206
std::shared_ptr< font::Loader > getFonts()
==============================================================================
Definition: gui.cpp:140
std::string getCapturedKeyboardInput() const
Returns all of the captured keyboard input without clearing it.
Definition: gui.cpp:122
void layoutFrame(GUIState state)
Adds widgets to the layout depending on the specified GUI state.
Definition: gui.cpp:144
GLint GLenum GLint x
Definition: glad.h:1655
GLint y
Definition: glad.h:1516
GUIState
Definition: gui.hpp:39
Definition: config.hpp:12
Information about a player that has connected to the current lobby.
Definition: sharedgamestate.hpp:37