Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
textinput.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include <string>
9#include <memory>
10
11namespace gui {
12 class GUI;
13}
14
15namespace gui::widget {
16
22class TextInput : public Widget {
23public:
24 using Ptr = std::unique_ptr<TextInput>;
25
35 template <typename... Params>
36 static Ptr make(Params&&... params) {
37 return std::make_unique<TextInput>(std::forward<Params>(params)...);
38 }
39
40 TextInput(glm::vec2 origin,
41 const std::string& placeholder,
43 std::shared_ptr<font::Loader> fonts,
44 DynText::Options options);
45
46 void render() override;
47
48 bool hasHandle(Handle handle) const override;
49 Widget* borrow(Handle handle) override;
50 void doClick(float x, float y) override;
51 void doHover(float x, float y) override;
52
53private:
54 static std::string prev_input;
55
57
60};
61
62}
Definition: gui.hpp:63
std::unique_ptr< DynText > Ptr
Definition: dyntext.hpp:16
Definition: textinput.hpp:22
void doClick(float x, float y) override
Performs a click at the specified (x,y) position in the GUI coordinate frame.
Definition: textinput.cpp:73
bool hasHandle(Handle handle) const override
======================================================================================
Definition: textinput.cpp:53
std::unique_ptr< TextInput > Ptr
Definition: textinput.hpp:24
Widget * borrow(Handle handle) override
Gives a pointer to the subwidget specified by the handle.
Definition: textinput.cpp:58
static Ptr make(Params &&... params)
Constructs a TextInput unique ptr widget.
Definition: textinput.hpp:36
void doHover(float x, float y) override
Performs a hover action at the specified (x,y) position in the GUI coordinate frame.
Definition: textinput.cpp:81
void render() override
======================================================================================
Definition: textinput.cpp:48
Definition: widget.hpp:41
glm::vec2 origin
Origin position (bottom left) of the widget in GUI coordinates.
Definition: widget.hpp:217
Handle handle
======================================================================================
Definition: widget.hpp:207
GLint GLenum GLint x
Definition: glad.h:1655
GLint y
Definition: glad.h:1516
GLenum const GLfloat * params
Definition: glad.h:1522
Definition: centertext.hpp:6
std::size_t Handle
Type for a Widget Handle.
Definition: widget.hpp:16
Definition: font.hpp:9
Definition: dyntext.hpp:19