19 #ifndef HEADER_SCREEN_HPP
20 #define HEADER_SCREEN_HPP
25 #include "utils/cpp2011.hpp"
27 #include <irrString.h>
28 #include <IXMLReader.h>
32 namespace gui {
class IGUIElement; }
36 #include "config/stk_config.hpp"
37 #include "guiengine/abstract_top_level_container.hpp"
38 #include "guiengine/engine.hpp"
39 #include "guiengine/event_handler.hpp"
40 #include "guiengine/widget.hpp"
41 #include "input/input.hpp"
42 #include "utils/leak_check.hpp"
43 #include "utils/ptr_vector.hpp"
57 template<
typename SCREEN>
61 static SCREEN* singleton;
69 static SCREEN* getInstance()
71 if (singleton == NULL)
73 singleton =
new SCREEN();
80 template <
typename SCREEN> SCREEN*
116 unsigned m_width, m_height;
120 std::string m_filename;
135 static
void parseScreenFileDiv(irr::io::IXMLReader* xml,
137 irr::gui::IGUIElement* parent = NULL);
139 Screen(
bool pause_race=true);
141 Screen(const
char* filename,
bool pause_race=true);
145 bool operator ==(const
char* filename)
const {
return m_filename == filename; }
154 void calculateLayout();
156 void manualAddWidget(
Widget* w);
158 void manualRemoveWidget(
Widget* w);
164 bool getUpdateInBackground() {
return m_update_in_background;}
167 const std::string&
getName()
const {
return m_filename; }
169 virtual void unload();
247 virtual void tearDown();
281 virtual void onResize();
293 virtual int getWidth() {
return m_width; }
295 virtual int getHeight() {
return m_height; }
303 const unsigned int value,
304 Input::InputType type,
306 {
return EVENT_LET; }
341 virtual void onCutsceneEnd() = 0;
Represents a GUI widgets container.
Definition: abstract_top_level_container.hpp:43
Definition: screen.hpp:334
Declares a class to be a singleton.
Definition: screen.hpp:59
Represents a single GUI screen.
Definition: screen.hpp:94
virtual void onDialogClose()
Callback that gets called when a dialog is closed.
Definition: screen.hpp:327
bool m_pause_race
True if the race (if it is running) should be paused when this screen is shown.
Definition: screen.hpp:99
virtual void eventCallback(Widget *widget, const std::string &name, const int playerID)=0
will be called everytime something happens.
unsigned int m_magic_number
to catch errors as early as possible, for debugging purposes only
Definition: screen.hpp:114
bool m_update_in_background
When set to true it updates the screen even if modal dialog is opened.
Definition: screen.hpp:111
virtual void filterInput(Input::InputType type, int deviceID, int btnID, int axisDir, int value)
Override this if you need to be notified of raw input in subclasses.
Definition: screen.hpp:318
virtual void onDisabledItemClicked(const std::string &item)
Callback you can use if you want to know when the user pressed on a disabled ribbon item.
Definition: screen.hpp:312
bool isLoaded() const
Definition: screen.hpp:150
virtual void beforeAddingWidget()
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: screen.hpp:222
virtual void onFocusChanged(Widget *previous, Widget *focus, int playerID)
Callback called when focus changes.
Definition: screen.hpp:330
virtual void loadedFromFile()=0
Callback invoked when loading this menu.
virtual void onUpdate(float dt)
optional callback you can override to be notified at every frame.
Definition: screen.hpp:271
virtual MusicInformation * getInGameMenuMusic() const
Definition: screen.hpp:291
const std::string & getName() const
Definition: screen.hpp:167
virtual bool onEscapePressed()
Called when escape is pressed.
Definition: screen.hpp:254
void setNeeds3D(bool needs3D)
Invoke this method for screens that use a 3D scene as background.
Definition: screen.hpp:186
void setUpdateInBackground(bool value)
When set to true it updates the screen even if modal dialog is opened.
Definition: screen.hpp:163
virtual MusicInformation * getMusic() const
Definition: screen.hpp:286
virtual void unloaded()
Callback invoked when this screen is being unloaded.
Definition: screen.hpp:215
bool needs3D()
Will be called to determine if the 3D scene must be rendered when at this screen.
Definition: screen.hpp:174
virtual void onDraw(float dt)
optional callback you can override to be notified at every frame.
Definition: screen.hpp:276
virtual EventPropagation filterActions(PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId)
Override this if you need to be notified of player actions in subclasses.
Definition: screen.hpp:301
bool m_render_3d
Will be called to determine if the 3D scene must be rendered when at this screen.
Definition: screen.hpp:106
Object used to render the GUI widgets see Overview of GUI skin for more information about skinning in...
Definition: skin.hpp:280
Definition: ptr_vector.hpp:44
MusicInformation * m_title_music
Filename of the title music to play.
Definition: stk_config.hpp:170
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
void addScreenToList(Screen *cutscene)
Add a screen to the list of screens known by the gui engine.
Definition: engine.cpp:964