|
Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
|
#include <staticimg.hpp>
Public Types | |
| using | Ptr = std::unique_ptr< StaticImg > |
Public Types inherited from gui::widget::Widget | |
| using | Ptr = std::unique_ptr< Widget > |
Public Member Functions | |
| StaticImg (glm::vec2 origin, gui::img::Img img, float size=1.0f) | |
| StaticImg (gui::img::Img img) | |
| ~StaticImg () | |
| void | changeImage (gui::img::Img img) |
| void | render () override |
| ====================================================================================== More... | |
Public Member Functions inherited from gui::widget::Widget | |
| Widget (Type type, glm::vec2 origin) | |
| Sets the type and origin position of the widget, and assigns a new unique handle. More... | |
| virtual | ~Widget ()=default |
| void | setOrigin (glm::vec2 origin) |
| Overrides the current origin position with the newly specified one. More... | |
| virtual void | lock () |
| Function that is run after all of the widgets have been added to the screee but before any input handling has occurred. More... | |
| CallbackHandle | addOnClick (Callback callback) |
| ====================================================================================== More... | |
| CallbackHandle | addOnHover (Callback callback) |
| Register a new onHover callback function for this widget. More... | |
| void | removeOnClick (CallbackHandle handle) |
| Removes the onClick callback function associated with the given handle. More... | |
| void | removeOnHover (CallbackHandle handle) |
| Removes the onHover callback function associated with the given handle. More... | |
| virtual void | doClick (float x, float y) |
| Performs a click at the specified (x,y) position in the GUI coordinate frame. More... | |
| virtual void | doHover (float x, float y) |
| Performs a hover action at the specified (x,y) position in the GUI coordinate frame. More... | |
| virtual void | render ()=0 |
| ====================================================================================== More... | |
| Type | getType () const |
| ====================================================================================== More... | |
| const glm::vec2 & | getOrigin () const |
| Queries the origin position of the widget. More... | |
| std::pair< std::size_t, std::size_t > | getSize () const |
| Queries the size of the widget in pixels. More... | |
| Handle | getHandle () const |
| Queries the handle for this specific widget. More... | |
| virtual bool | hasHandle (Handle handle) const |
| ====================================================================================== More... | |
| virtual Widget * | borrow (Handle handle) |
| Gives a pointer to the subwidget specified by the handle. More... | |
Static Public Member Functions | |
| template<typename... Params> | |
| static Ptr | make (Params &&... params) |
| creates a StaticImg unique ptr widget More... | |
Data Fields | |
| float | size_width |
| float | size_height |
Static Public Attributes | |
| static std::unique_ptr< Shader > | shader = nullptr |
Additional Inherited Members | |
Protected Attributes inherited from gui::widget::Widget | |
| Handle | handle |
| ====================================================================================== More... | |
| Type | type |
| Type of the widget. More... | |
| glm::vec2 | origin |
| Origin position (bottom left) of the widget in GUI coordinates. More... | |
| std::size_t | width {0} |
| Width of the widget, in pixels. More... | |
| std::size_t | height {0} |
| Height of the widget, in pixels. More... | |
| std::unordered_map< CallbackHandle, Callback > | on_clicks |
| all of the onClick handlers, indexable by handle More... | |
| std::unordered_map< CallbackHandle, Callback > | on_hovers |
| all of the onHover handlers, indexable by handle More... | |
Static Protected Attributes inherited from gui::widget::Widget | |
| static std::size_t | num_widgets = 0 |
| Static counter for the number of widgets that have been created, so a new identifier can be assigned to each widget as they are created. More... | |
Widget to display a static image (png) to the screen.
BUG: This doesn't work at all currently! ASDAJSHHASHDAHHHHHHH!
Reference: The chapter on sprite rendering from https://learnopengl.com/book/book_pdf.pdf
| using gui::widget::StaticImg::Ptr = std::unique_ptr<StaticImg> |
| gui::widget::StaticImg::StaticImg | ( | glm::vec2 | origin, |
| gui::img::Img | img, | ||
| float | size = 1.0f |
||
| ) |
|
explicit |
| gui::widget::StaticImg::~StaticImg | ( | ) |
| void gui::widget::StaticImg::changeImage | ( | gui::img::Img | img | ) |
|
inlinestatic |
|
overridevirtual |
======================================================================================
=<DISPLAY>============================================================================
Renders the widget to the screen
This is the only function that must be overridden by derived classes.
Implements gui::widget::Widget.
|
static |
| float gui::widget::StaticImg::size_height |
| float gui::widget::StaticImg::size_width |