19#ifndef HEADER_ENGINE_HPP
20#define HEADER_ENGINE_HPP
33 namespace gui {
class IGUIEnvironment;
class ScalableFont; }
34 namespace video {
class IVideoDriver;
class ITexture; }
40#include "utils/constants.hpp"
41#include "utils/ptr_vector.hpp"
56 class AbstractStateManager;
85 extern irr::gui::IGUIEnvironment* g_env;
96 extern irr::IrrlichtDevice* g_device;
97 extern irr::video::IVideoDriver* g_driver;
98 extern Screen* g_current_screen;
99 extern AbstractStateManager* g_state_manager;
100 extern Widget* g_focus_for_player[MAX_PLAYER_COUNT];
114 void init(irr::IrrlichtDevice* device, irr::video::IVideoDriver* driver,
121 void resetGlobalVariables();
126 inline irr::IrrlichtDevice*
getDevice() {
return Private::g_device; }
131 inline irr::gui::IGUIEnvironment*
getGUIEnv() {
return Private::g_env; }
136 inline irr::video::IVideoDriver*
getDriver() {
return Private::g_driver; }
185 void clearScreenCache();
193 inline void setSkin(Skin* skin) { Private::g_skin = skin; }
194 Screen* getScreenNamed(
const char* name);
216 void showMessage(
const irr::core::stringw& message,
const float time=5.0f);
244 void render(
float dt,
bool is_loading =
false);
246 void clearLoadingTips();
249 void renderLoading(
bool clearIcons =
true,
bool launching =
false,
bool update_tips =
true);
286 inline void disableGraphics() {}
287 constexpr bool isNoGraphics() {
return true; }
289 void disableGraphics();
Abstract base class you must override from to use the GUI engine.
Definition: abstract_state_manager.hpp:54
Represents a single GUI screen.
Definition: screen.hpp:97
Object used to render the GUI widgets see Overview of GUI skin for more information about skinning in...
Definition: skin.hpp:269
Definition: ptr_vector.hpp:44
Definition: scalable_font.hpp:35
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
irr::IrrlichtDevice * getDevice()
Definition: engine.hpp:126
irr::gui::ScalableFont * getTitleFont()
Definition: engine.hpp:163
int getFontHeight()
Definition: engine.cpp:838
void renderLoading(bool clearIcons, bool launching, bool update_tips)
renders a "loading" screen
Definition: engine.cpp:1445
irr::gui::ScalableFont * getSmallFont()
Definition: engine.hpp:141
void reloadSkin()
call when skin in user config was updated
Definition: engine.cpp:1199
irr::gui::ScalableFont * getLargeFont()
Definition: engine.hpp:153
Widget * getWidget(const char *name)
Finds a widget from its name (PROP_ID) in the current screen/dialog.
Definition: engine.cpp:1596
void addLoadingIcon(irr::video::ITexture *icon)
to spice up a bit the loading icon : add icons to the loading screen
Definition: engine.cpp:1575
irr::gui::IGUIEnvironment * getGUIEnv()
Definition: engine.hpp:131
int getSmallFontHeight()
Definition: engine.cpp:844
irr::gui::ScalableFont * getTinyTitleFont()
Definition: engine.hpp:173
irr::gui::ScalableFont * getSmallTitleFont()
Definition: engine.hpp:168
void cleanUp()
Clean some of the cached data, either for a shutdown or a reload.
Definition: engine.cpp:1000
void update(float dt)
Updates all widgets that need to be updated.
Definition: engine.cpp:872
irr::gui::ScalableFont * getHighresDigitFont()
Definition: engine.hpp:158
void clear()
erases the currently displayed screen, removing all added irrLicht widgets
Definition: engine.cpp:857
Skin * getSkin()
Definition: engine.hpp:191
int getTitleFontHeight()
Definition: engine.cpp:821
void reloadForNewSize()
call when screen size changed
Definition: engine.cpp:1229
float getLatestDt()
Definition: engine.cpp:755
void switchToScreen(Screen *screen)
Low-level mean to change current screen.
Definition: engine.cpp:925
void render(float elapsed_time, bool is_loading)
called on every frame to trigger the rendering of the GUI.
Definition: engine.cpp:1259
irr::gui::ScalableFont * getFont()
Definition: engine.hpp:146
PtrVector< Widget, REF > needsUpdate
Widgets that need to be notified at every frame can add themselves there (FIXME: unclean)
Definition: engine.cpp:748
void addGUIFunctionBeforeRendering(std::function< void()> func)
Add gui-related function before rendering GUI (from other thread)
Definition: engine.cpp:1245
void deallocate()
To be called after cleanup().
Definition: engine.cpp:1075
Screen * getCurrentScreen()
Definition: engine.hpp:178
void cleanForGame()
like GUIEngine::clear, but to be called before going into game
Definition: engine.cpp:901
AbstractStateManager * getStateManager()
Definition: engine.hpp:183
void focusNothingForPlayer(const unsigned int playerID)
Focuses nothing for given player (removes any selection for this player).
Definition: engine.cpp:799
void removeScreen(Screen *screen)
Remove a screen from the list of screens known by the gui engine.
Definition: engine.cpp:969
bool isFocusedForPlayer(const Widget *w, const unsigned int playerID)
Returns whether given the widget is currently focused by given player.
Definition: engine.cpp:808
void flushRenderLoading(bool launching)
poll events during rendering to prevent unresponsive window
Definition: engine.cpp:1542
void addScreenToList(Screen *cutscene)
Add a screen to the list of screens known by the gui engine.
Definition: engine.cpp:962
irr::video::IVideoDriver * getDriver()
Definition: engine.hpp:136
Widget * getFocusForPlayer(const unsigned int playerID)
Returns the widget currently focused by given player, or NULL if none.
Definition: engine.cpp:791
void reshowCurrentScreen()
to be called after e.g.
Definition: engine.cpp:988