TGUI  0.9-dev
BackendGuiSFML.hpp
1
2//
3// TGUI - Texus' Graphical User Interface
4// Copyright (C) 2012-2021 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
26#ifndef TGUI_BACKEND_GUI_SFML_HPP
27#define TGUI_BACKEND_GUI_SFML_HPP
28
29#include <TGUI/Backend/Window/BackendGui.hpp>
30
31#include <SFML/Window.hpp>
32
34
35namespace tgui
36{
38
39 class TGUI_API BackendGuiSFML : public BackendGui
40 {
41 public:
42
48 BackendGuiSFML() = default;
49
50
58 BackendGuiSFML(sf::Window& window);
59
60
66 virtual void setWindow(sf::Window& window);
67
68
85 bool handleEvent(sf::Event event);
87
88
113 void mainLoop() override;
114
115
124 bool convertEvent(const sf::Event& eventSFML, Event& eventTGUI);
125
126
128 protected:
129
131 // Updates the view and changes the size of the root container when needed
133 void updateContainerSize() override;
134
135
137 protected:
138
139 sf::Window* m_window = nullptr;
140
142 };
143}
144
146
147#endif // TGUI_BACKEND_GUI_SFML_HPP
Definition: BackendGuiSFML.hpp:40
bool convertEvent(const sf::Event &eventSFML, Event &eventTGUI)
Helper function that converts an SFML event to a TGUI event.
bool handleEvent(sf::Event event)
Passes the event to the widgets.
BackendGuiSFML(sf::Window &window)
Constructs the gui and set the window on which the gui should be drawn.
virtual void setWindow(sf::Window &window)
Sets the target on which the gui should be drawn.
BackendGuiSFML()=default
Default constructor.
void mainLoop() override
Give the gui control over the main loop.
Base class for the Gui.
Definition: BackendGui.hpp:45
bool handleEvent(Event event)
Passes the event to the widgets.
Namespace that contains all TGUI functions and classes.
Definition: AbsoluteOrRelativeValue.hpp:36
Definition: Event.hpp:37