#include <gui.h>
Inheritance diagram for hoa_video::private_video::GUISupervisor:


Public Member Functions | |
| void | AddMenuWindow (MenuWindow *new_window) |
| Adds a newly created MenuWindow into the map of existing windows. | |
| void | DeleteMenuSkin (std::string &skin_name) |
| Deletes a menu skin that has been loaded. | |
| void | DrawFPS (uint32 frame_time) |
| Updates the FPS counter and draws it on the screen. | |
| MenuSkin * | GetDefaultMenuSkin () const |
| Returns a pointer to the default menu skin. | |
| MenuSkin * | GetMenuSkin (std::string &skin_name) |
| Returns a pointer to the MenuSkin of a corresponding skin name. | |
| uint32 | GetNextMenuWindowID () |
| Returns the next available MenuWindow ID for a MenuWindow to use. | |
| GUISupervisor () | |
| bool | LoadMenuSkin (std::string skin_name, std::string border_image, std::string background_image="", Color top_left=Color::clear, Color top_right=Color::clear, Color bottom_left=Color::clear, Color bottom_right=Color::clear, bool make_default=false) |
| Prepares a new menu skin for use in game. | |
| void | RemoveMenuWindow (MenuWindow *old_window) |
| Removes an existing MenuWindow from the map of existing windows. | |
| void | SetDefaultMenuSkin (std::string &skin_name) |
| Sets the default menu skin to use from the set of pre-loaded skins. | |
| bool | SingletonInitialize () |
| A method for the inheriting class to implement, which initializes the class. | |
| ~GUISupervisor () | |
Private Attributes | |
| uint32 | _current_sample |
| An index variable to keep track of the start of the circular fps_samples array. | |
| MenuSkin * | _default_skin |
| A pointer to the default menu skin that GUI objects will use if a skin is not explicitly declared If no menu skins exist, this member will be NULL. It will never be NULL as long as one menu skin is loaded. If the default menu skin is deleted by the user, an alternative default skin will automatically be set. | |
| uint32 | _fps_samples [FPS_SAMPLES] |
| A circular array of FPS samples used for calculating average FPS. | |
| uint32 | _fps_sum |
| Keeps track of the sum of FPS values over the last VIDEO_FPS_SAMPLES frames This is used to simplify the calculation of average frames per second. | |
| std::map< std::string, MenuSkin > | _menu_skins |
| A map containing all of the menu skins which have been loaded The string argument is the reference name of the menu, which is defined by the user when they load a new skin. | |
| std::map< uint32, MenuWindow * > | _menu_windows |
| A map containing all of the actively created MenuWindow objects The integer key is the MenuWindow's ID number. This primary purpose of this map is to coordinate menu windows with menu skins. A menu skin can not be deleted when a menu window is still using that skin, and menu windows must be re-drawn when the properties of a menu skin that it uses changes. | |
| uint32 | _next_window_id |
| The next ID to assign to a MenuWindow when one is created. | |
| uint32 | _number_samples |
| The number of FPS samples currently recorded. This value should always be VIDEO_FPS_SAMPLES, unless the game has just started, in which case it could be anywhere from 0 to VIDEO_FPS_SAMPLES depending on how many frames have been displayed. | |
Friends | |
| class | hoa_utils::Singleton< GUISupervisor > |
****************************************************************************
There is exactly one instance of this class, which is both created and destroyed by the GameVideo class. This class is essentially an extension of the GameVideo class which manages the GUI system. It also happens to handle the drawing of the average frames per second (FPS) on the screen.
Definition at line 179 of file gui.h.
| hoa_video::private_video::GUISupervisor::GUISupervisor | ( | ) |
Definition at line 138 of file gui.cpp.
References _current_sample, _fps_samples, _fps_sum, _number_samples, and hoa_video::private_video::FPS_SAMPLES.
| hoa_video::private_video::GUISupervisor::~GUISupervisor | ( | ) |
Definition at line 149 of file gui.cpp.
References _menu_skins, _menu_windows, hoa_video::GameVideo::DeleteImage(), hoa_video::VIDEO_DEBUG, and hoa_video::VideoManager.
Here is the call graph for this function:

| void hoa_video::private_video::GUISupervisor::AddMenuWindow | ( | MenuWindow * | new_window | ) |
Adds a newly created MenuWindow into the map of existing windows.
| new_window | A pointer to the newly created MenuWindow Don't call this method anywhere else but from MenuWindow::Create(), or you may cause problems. |
Definition at line 291 of file gui.cpp.
References hoa_video::MenuWindow::_id, _menu_windows, and hoa_video::VIDEO_DEBUG.
Referenced by hoa_video::MenuWindow::Create().
| void hoa_video::private_video::GUISupervisor::DeleteMenuSkin | ( | std::string & | skin_name | ) |
Deletes a menu skin that has been loaded.
| skin_name | The name of the loaded menu skin that should be removed |
Definition at line 266 of file gui.cpp.
References _menu_skins, _menu_windows, and hoa_video::VIDEO_DEBUG.
| void hoa_video::private_video::GUISupervisor::DrawFPS | ( | uint32 | frame_time | ) |
Updates the FPS counter and draws it on the screen.
| frame_time | The number of milliseconds it took for the last frame. |
Definition at line 316 of file gui.cpp.
References _current_sample, _fps_samples, _fps_sum, _number_samples, hoa_video::GameVideo::DrawText(), hoa_video::private_video::FPS_CATCHUP, hoa_video::private_video::FPS_SAMPLES, hoa_video::private_video::MAX_FTIME_DIFF, hoa_video::GameVideo::Move(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::GameVideo::SetFont(), hoa_video::GameVideo::SetTextColor(), hoa_video::VIDEO_BLEND, hoa_video::VIDEO_DEBUG, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_X_NOFLIP, hoa_video::VIDEO_Y_BOTTOM, hoa_video::VIDEO_Y_NOFLIP, hoa_video::VideoManager, and hoa_video::Color::white.
Referenced by hoa_video::GameVideo::DrawFPS().
Here is the call graph for this function:

| MenuSkin* hoa_video::private_video::GUISupervisor::GetDefaultMenuSkin | ( | ) | const [inline] |
Returns a pointer to the default menu skin.
Definition at line 220 of file gui.h.
References _default_skin.
Referenced by hoa_video::MenuWindow::Create().
| MenuSkin* hoa_video::private_video::GUISupervisor::GetMenuSkin | ( | std::string & | skin_name | ) | [inline] |
Returns a pointer to the MenuSkin of a corresponding skin name.
| skin_name | The name of the menu skin to grab |
Definition at line 227 of file gui.h.
References _menu_skins.
| uint32 hoa_video::private_video::GUISupervisor::GetNextMenuWindowID | ( | ) | [inline] |
Returns the next available MenuWindow ID for a MenuWindow to use.
Definition at line 243 of file gui.h.
References _next_window_id.
Referenced by hoa_video::MenuWindow::MenuWindow().
| bool hoa_video::private_video::GUISupervisor::LoadMenuSkin | ( | std::string | skin_name, | |
| std::string | border_image, | |||
| std::string | background_image = "", |
|||
| Color | top_left = Color::clear, |
|||
| Color | top_right = Color::clear, |
|||
| Color | bottom_left = Color::clear, |
|||
| Color | bottom_right = Color::clear, |
|||
| bool | make_default = false | |||
| ) |
Prepares a new menu skin for use in game.
| skin_name | The name that will be used to refer to the skin after it is successfully loaded | |
| border_image | The filename for the multi-image that contains the menu's border images | |
| background_image | The filename for the skin's background image (optional) | |
| top_left | Sets the background color for the top left portion of the skin | |
| top_right | Sets the background color for the top right portion of the skin | |
| bottom_left | Sets the background color for the bottom left portion of the skin | |
| bottom_right | Sets the background color for the bottom right portion of the skin | |
| make_default | If this skin should be the default menu skin to be used, set this argument to true |
Referenced by hoa_video::GameVideo::LoadMenuSkin().
| void hoa_video::private_video::GUISupervisor::RemoveMenuWindow | ( | MenuWindow * | old_window | ) |
Removes an existing MenuWindow from the map of existing windows.
| old_window | A pointer to the MenuWindow to be removed Don't call this method anywhere else but from MenuWindow::Destroy(), or you may cause problems. |
Definition at line 302 of file gui.cpp.
References hoa_video::MenuWindow::_id, _menu_windows, and hoa_video::VIDEO_DEBUG.
Referenced by hoa_video::MenuWindow::Destroy().
| void hoa_video::private_video::GUISupervisor::SetDefaultMenuSkin | ( | std::string & | skin_name | ) |
Sets the default menu skin to use from the set of pre-loaded skins.
| skin_name | The name of the already loaded menu skin that should be made the default skin |
Definition at line 254 of file gui.cpp.
References _default_skin, _menu_skins, and hoa_video::VIDEO_DEBUG.
| bool hoa_video::private_video::GUISupervisor::SingletonInitialize | ( | ) | [virtual] |
A method for the inheriting class to implement, which initializes the class.
Implements hoa_utils::Singleton< T >.
Definition at line 184 of file gui.cpp.
Referenced by hoa_video::GameVideo::SingletonInitialize().
friend class hoa_utils::Singleton< GUISupervisor > [friend] |
An index variable to keep track of the start of the circular fps_samples array.
Definition at line 300 of file gui.h.
Referenced by DrawFPS(), and GUISupervisor().
A pointer to the default menu skin that GUI objects will use if a skin is not explicitly declared If no menu skins exist, this member will be NULL. It will never be NULL as long as one menu skin is loaded. If the default menu skin is deleted by the user, an alternative default skin will automatically be set.
Definition at line 286 of file gui.h.
Referenced by GetDefaultMenuSkin(), and SetDefaultMenuSkin().
A circular array of FPS samples used for calculating average FPS.
Definition at line 292 of file gui.h.
Referenced by DrawFPS(), and GUISupervisor().
Keeps track of the sum of FPS values over the last VIDEO_FPS_SAMPLES frames This is used to simplify the calculation of average frames per second.
Definition at line 297 of file gui.h.
Referenced by DrawFPS(), and GUISupervisor().
std::map<std::string, MenuSkin> hoa_video::private_video::GUISupervisor::_menu_skins [private] |
A map containing all of the menu skins which have been loaded The string argument is the reference name of the menu, which is defined by the user when they load a new skin.
Definition at line 273 of file gui.h.
Referenced by DeleteMenuSkin(), GetMenuSkin(), SetDefaultMenuSkin(), and ~GUISupervisor().
std::map<uint32, MenuWindow*> hoa_video::private_video::GUISupervisor::_menu_windows [private] |
A map containing all of the actively created MenuWindow objects The integer key is the MenuWindow's ID number. This primary purpose of this map is to coordinate menu windows with menu skins. A menu skin can not be deleted when a menu window is still using that skin, and menu windows must be re-drawn when the properties of a menu skin that it uses changes.
Definition at line 280 of file gui.h.
Referenced by AddMenuWindow(), DeleteMenuSkin(), RemoveMenuWindow(), and ~GUISupervisor().
The next ID to assign to a MenuWindow when one is created.
Definition at line 289 of file gui.h.
Referenced by GetNextMenuWindowID().
The number of FPS samples currently recorded. This value should always be VIDEO_FPS_SAMPLES, unless the game has just started, in which case it could be anywhere from 0 to VIDEO_FPS_SAMPLES depending on how many frames have been displayed.
Definition at line 307 of file gui.h.
Referenced by DrawFPS(), and GUISupervisor().
1.5.1