TGUI  1.6.1
Loading...
Searching...
No Matches
BackendGuiRaylib.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2024 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/Config.hpp>
29#if !TGUI_BUILD_AS_CXX_MODULE
30 #include <TGUI/Backend/Window/BackendGui.hpp>
31#endif
32
33#include <raylib.h>
34
36
37TGUI_MODULE_EXPORT namespace tgui
38{
42 class TGUI_API BackendGuiRaylib : public BackendGui
43 {
44 public:
45
50
55
67
84 bool handleCharPressed(int pressedChar);
85
102 bool handleKeyPressed(int pressedKey);
103
143 void mainLoop(Color clearColor = {240, 240, 240}) override;
144
154 void updateTextCursorPosition(FloatRect inputRect, Vector2f caretPos) override;
155
163 TGUI_NODISCARD bool isKeyboardModifierPressed(Event::KeyModifier modifierKey) const override;
164
172
180 std::vector<Event> generateEventQueue(bool processKeyEvents);
181
183 protected:
184
186 // Updates the view and changes the size of the root container when needed
188 void updateContainerSize() override;
189
191 protected:
192
193 bool m_mouseOnWindow = true;
194 bool m_endMainLoop = false;
195 };
196}
197
199
200#endif // TGUI_BACKEND_GUI_RAYLIB_HPP
Definition BackendGuiRaylib.hpp:43
BackendGuiRaylib()
Default constructor.
~BackendGuiRaylib()
Destructor.
bool handleKeyPressed(int pressedKey)
Passes the key press event to the focused widget.
bool isKeyboardModifierPressed(Event::KeyModifier modifierKey) const override
Checks the state for one of the modifier keys.
bool handleEvents()
Processes events that occured during the last frame and passes the event to the widgets.
void endMainLoop()
Breaks out of the main loop that is implemented inside the mainLoop function.
void mainLoop(Color clearColor={240, 240, 240}) override
Give the gui control over the main loop.
bool handleCharPressed(int pressedChar)
Passes the typed character to the focused widget.
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...
std::vector< Event > generateEventQueue(bool processKeyEvents)
Processes events that occured during the last frame and turns them into TGUI events for handleEvent.
Base class for the Gui.
Definition BackendGui.hpp:47
Wrapper for colors.
Definition Color.hpp:73
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:38
KeyModifier
Modifiers keys.
Definition Event.hpp:157