TGUI
=
=
Download
Tutorials
1.x
0.9
0.8
Documentation
1.x
0.9
0.8
Examples
1.x
0.9
0.8
Community
TGUI
1.x-dev
Toggle main menu visibility
Loading...
Searching...
No Matches
include
TGUI
Backend
Window
Raylib
BackendGuiRaylib.hpp
1
2
//
3
// TGUI - Texus' Graphical User Interface
4
// Copyright (C) 2012-2026 Bruno Van de Velde (vdv_b@tgui.eu)
5
//
6
// This software is provided 'as-is', without any express or implied warranty.
7
// In no event will the authors be held liable for any damages arising from the use of this software.
8
//
9
// Permission is granted to anyone to use this software for any purpose,
10
// including commercial applications, and to alter it and redistribute it freely,
11
// subject to the following restrictions:
12
//
13
// 1. The origin of this software must not be misrepresented;
14
// you must not claim that you wrote the original software.
15
// If you use this software in a product, an acknowledgment
16
// in the product documentation would be appreciated but is not required.
17
//
18
// 2. Altered source versions must be plainly marked as such,
19
// and must not be misrepresented as being the original software.
20
//
21
// 3. This notice may not be removed or altered from any source distribution.
22
//
24
25
#ifndef TGUI_BACKEND_GUI_RAYLIB_HPP
26
#define TGUI_BACKEND_GUI_RAYLIB_HPP
27
28
#include <TGUI/Backend/Window/BackendGui.hpp>
29
30
#include <raylib.h>
31
33
34
namespace
tgui
35
{
39
class
TGUI_API
BackendGuiRaylib
:
public
BackendGui
40
{
41
public
:
45
BackendGuiRaylib
();
46
50
~BackendGuiRaylib
();
51
65
bool
handleEvents
();
66
85
bool
handleCharPressed
(
int
pressedChar);
86
106
bool
handleKeyPressed
(
int
pressedKey);
107
147
void
mainLoop
(
Color
clearColor = {240, 240, 240})
override
;
148
158
void
updateTextCursorPosition
(FloatRect inputRect, Vector2f caretPos)
override
;
159
167
[[nodiscard]]
bool
isKeyboardModifierPressed
(
Event::KeyModifier
modifierKey)
const override
;
168
175
void
endMainLoop
();
176
184
std::vector<Event>
generateEventQueue
(
bool
processKeyEvents);
185
192
void
startTextInput
(FloatRect inputRect)
override
;
193
198
void
stopTextInput
()
override
;
199
213
void
setSoftKeyboardFunctions
(std::function<
void
()> showKeyboardFunc,
214
std::function<
void
()> hideKeyboardFunc,
215
std::function<
int
()> getKeyUnicodeFunc,
216
std::function<
void
()> clearLastKeyFunc);
217
219
220
protected
:
222
// Updates the view and changes the size of the root container when needed
224
void
updateContainerSize()
override
;
225
227
228
protected
:
229
bool
m_mouseOnWindow =
true
;
230
bool
m_endMainLoop =
false
;
231
232
std::function<void()> m_showSoftKeyboardFunction;
233
std::function<void()> m_hideSoftKeyboardFunction;
234
std::function<int()> m_getLastSoftKeyUnicodeFunction;
235
std::function<void()> m_clearLastSoftKeyFunction;
236
};
237
}
// namespace tgui
238
240
241
#endif
// TGUI_BACKEND_GUI_RAYLIB_HPP
tgui::BackendGuiRaylib::stopTextInput
void stopTextInput() override
This function is called by TGUI when unfocusing a text field (EditBox or TextArea)....
tgui::BackendGuiRaylib::BackendGuiRaylib
BackendGuiRaylib()
Default constructor.
tgui::BackendGuiRaylib::startTextInput
void startTextInput(FloatRect inputRect) override
This function is called by TGUI when focusing a text field (EditBox or TextArea). It may result in th...
tgui::BackendGuiRaylib::~BackendGuiRaylib
~BackendGuiRaylib()
Destructor.
tgui::BackendGuiRaylib::handleKeyPressed
bool handleKeyPressed(int pressedKey)
Passes the key press event to the focused widget.
tgui::BackendGuiRaylib::isKeyboardModifierPressed
bool isKeyboardModifierPressed(Event::KeyModifier modifierKey) const override
Checks the state for one of the modifier keys.
tgui::BackendGuiRaylib::setSoftKeyboardFunctions
void setSoftKeyboardFunctions(std::function< void()> showKeyboardFunc, std::function< void()> hideKeyboardFunc, std::function< int()> getKeyUnicodeFunc, std::function< void()> clearLastKeyFunc)
Sets functions that are called to control the soft/virtual keyboard.
tgui::BackendGuiRaylib::handleEvents
bool handleEvents()
Processes events that occured during the last frame and passes the event to the widgets.
tgui::BackendGuiRaylib::endMainLoop
void endMainLoop()
Breaks out of the main loop that is implemented inside the mainLoop function.
tgui::BackendGuiRaylib::mainLoop
void mainLoop(Color clearColor={240, 240, 240}) override
Give the gui control over the main loop.
tgui::BackendGuiRaylib::handleCharPressed
bool handleCharPressed(int pressedChar)
Passes the typed character to the focused widget.
tgui::BackendGuiRaylib::updateTextCursorPosition
void updateTextCursorPosition(FloatRect inputRect, Vector2f caretPos) override
This function is called by TGUI when the position of the caret changes in a text field (EditBox or Te...
tgui::BackendGuiRaylib::generateEventQueue
std::vector< Event > generateEventQueue(bool processKeyEvents)
Processes events that occured during the last frame and turns them into TGUI events for handleEvent.
tgui::BackendGui::BackendGui
BackendGui()
Default constructor.
tgui::Color
Wrapper for colors.
Definition
Color.hpp:63
tgui
Namespace that contains all TGUI functions and classes.
Definition
AbsoluteOrRelativeValue.hpp:37
tgui::Event::KeyModifier
KeyModifier
Modifiers keys.
Definition
Event.hpp:155
Generated on
for TGUI by
1.18.0