FIFE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FIFE::FifechanManager Class Reference

#include <fifechanmanager.h>

+ Inheritance diagram for FIFE::FifechanManager:
+ Collaboration diagram for FIFE::FifechanManager:

Public Member Functions

 FifechanManager ()
 Constructor. More...
 
virtual ~FifechanManager ()
 Destructor. More...
 
fcn::Gui * getFifechanGUI () const
 Gets the member pointer to the Fifechan GUI. More...
 
virtual void turn ()
 Performs the GUI logic and draws the GUI accordingly. More...
 
void init (const std::string &backend, int32_t screenWidth, int32_t screenHeight)
 Inits the Fifechan GUI Manager. More...
 
void resizeTopContainer (uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 Resizes the top container. More...
 
void add (fcn::Widget *widget)
 Adds a new widget. More...
 
void remove (fcn::Widget *widget)
 Removes a widget. More...
 
fcn::Container * getTopContainer () const
 Gets the top container. More...
 
ConsolegetConsole () const
 Gets the console. More...
 
GuiFontsetDefaultFont (const std::string &path, uint32_t size, const std::string &glyphs)
 Set the global font properties. More...
 
GuiFontgetDefaultFont ()
 Gets the default font. More...
 
GuiFontcreateFont (const std::string &path="", uint32_t size=0, const std::string &glyphs="")
 Gets font with given properties. More...
 
void releaseFont (GuiFont *font)
 Releases given font. More...
 
void invalidateFonts ()
 
virtual bool onSdlEvent (SDL_Event &evt)
 Called when an SDL event is received from SDL. More...
 
KeyEvent translateKeyEvent (const fcn::KeyEvent &evt)
 
MouseEvent translateMouseEvent (const fcn::MouseEvent &evt)
 
- Public Member Functions inherited from FIFE::IGUIManager
virtual ~IGUIManager ()
 Destructor. More...
 
- Public Member Functions inherited from FIFE::ISdlEventListener
virtual ~ISdlEventListener ()
 
- Public Member Functions inherited from FIFE::DynamicSingleton< FifechanManager >
 DynamicSingleton ()
 
virtual ~DynamicSingleton ()
 

Static Protected Member Functions

static int32_t convertFifechanKeyToFifeKey (int32_t value)
 

Private Attributes

fcn::Gui * m_fcn_gui
 
fcn::Graphics * m_gui_graphics
 
fcn::FocusHandler * m_focushandler
 
fcn::Container * m_fcn_topcontainer
 
GuiImageLoaderm_imgloader
 
fcn::SDLInput * m_input
 
Consolem_console
 
GuiFontm_defaultfont
 
std::vector< GuiFont * > m_fonts
 
std::set< fcn::Widget * > m_widgets
 
bool m_had_mouse
 
bool m_had_widget
 
std::string m_fontpath
 
std::string m_fontglyphs
 
int32_t m_fontsize
 
bool m_logic_executed
 

Additional Inherited Members

- Static Public Member Functions inherited from FIFE::DynamicSingleton< FifechanManager >
static FifechanManagerinstance ()
 

Detailed Description

Definition at line 66 of file fifechanmanager.h.

Constructor & Destructor Documentation

FIFE::FifechanManager::FifechanManager ( )

Constructor.

Definition at line 57 of file fifechanmanager.cpp.

References m_fcn_gui, m_fcn_topcontainer, m_focushandler, m_had_mouse, m_had_widget, m_imgloader, and m_input.

FIFE::FifechanManager::~FifechanManager ( )
virtual

Destructor.

Definition at line 80 of file fifechanmanager.cpp.

References m_console, m_fcn_gui, m_fcn_topcontainer, m_fonts, m_gui_graphics, m_imgloader, and m_input.

Member Function Documentation

void FIFE::FifechanManager::add ( fcn::Widget *  widget)

Adds a new widget.

Parameters
Apointer to the widget to add.

Definition at line 169 of file fifechanmanager.cpp.

References m_fcn_topcontainer, and m_widgets.

Referenced by FIFE::Console::doShow().

+ Here is the caller graph for this function:

GuiFont * FIFE::FifechanManager::createFont ( const std::string &  path = "",
uint32_t  size = 0,
const std::string &  glyphs = "" 
)

Gets font with given properties.

Note that font will be owned by Fifechan GUI Manager

Definition at line 203 of file fifechanmanager.cpp.

References m_fontglyphs, m_fontpath, m_fonts, and m_fontsize.

Referenced by FIFE::Console::Console(), and setDefaultFont().

+ Here is the caller graph for this function:

Console* FIFE::FifechanManager::getConsole ( ) const
inline

Gets the console.

Returns
The console.

Definition at line 126 of file fifechanmanager.h.

References m_console.

GuiFont* FIFE::FifechanManager::getDefaultFont ( )
inline

Gets the default font.

Definition at line 134 of file fifechanmanager.h.

References m_defaultfont.

fcn::Gui * FIFE::FifechanManager::getFifechanGUI ( ) const

Gets the member pointer to the Fifechan GUI.

Returns
The member pointer to the Fifechan GUI.

Definition at line 165 of file fifechanmanager.cpp.

References m_fcn_gui.

fcn::Container* FIFE::FifechanManager::getTopContainer ( ) const
inline

Gets the top container.

Returns
The top container.

Definition at line 120 of file fifechanmanager.h.

References m_fcn_topcontainer.

Referenced by FIFE::Console::doShow().

+ Here is the caller graph for this function:

void FIFE::FifechanManager::init ( const std::string &  backend,
int32_t  screenWidth,
int32_t  screenHeight 
)

Inits the Fifechan GUI Manager.

Parameters
graphicsbackend specific grapchics object to use
screenWidthwidth for the gui top container
screenHeightheight for the gui top container

Definition at line 183 of file fifechanmanager.cpp.

References m_console, m_fcn_gui, m_gui_graphics, and resizeTopContainer().

void FIFE::FifechanManager::invalidateFonts ( )

Definition at line 244 of file fifechanmanager.cpp.

References m_fonts.

Referenced by resizeTopContainer().

+ Here is the caller graph for this function:

bool FIFE::FifechanManager::onSdlEvent ( SDL_Event &  evt)
virtual

Called when an SDL event is received from SDL.

Parameters
evtSDL event

Implements FIFE::ISdlEventListener.

Definition at line 94 of file fifechanmanager.cpp.

References FIFE::_log, FL_WARN, m_fcn_topcontainer, m_focushandler, m_had_mouse, m_had_widget, and m_input.

void FIFE::FifechanManager::releaseFont ( GuiFont font)

Releases given font.

Definition at line 232 of file fifechanmanager.cpp.

References m_fonts.

void FIFE::FifechanManager::remove ( fcn::Widget *  widget)

Removes a widget.

Parameters
Apointer to the widget to remove.

Definition at line 176 of file fifechanmanager.cpp.

References m_fcn_topcontainer, and m_widgets.

Referenced by FIFE::Console::doHide().

+ Here is the caller graph for this function:

void FIFE::FifechanManager::resizeTopContainer ( uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)
virtual

Resizes the top container.

Parameters
xThe new starting X coordinate.
yThe new starting Y coordinate.
widthThe new width.
heightThe new height.

Implements FIFE::IGUIManager.

Definition at line 159 of file fifechanmanager.cpp.

References invalidateFonts(), m_console, m_fcn_topcontainer, and FIFE::Console::reLayout().

Referenced by init().

+ Here is the caller graph for this function:

GuiFont * FIFE::FifechanManager::setDefaultFont ( const std::string &  path,
uint32_t  size,
const std::string &  glyphs 
)

Set the global font properties.

Definition at line 252 of file fifechanmanager.cpp.

References createFont(), m_console, m_defaultfont, m_fontglyphs, m_fontpath, m_fontsize, and FIFE::Console::reLayout().

void FIFE::FifechanManager::turn ( )
virtual

Performs the GUI logic and draws the GUI accordingly.

This will be called each frame.

Implements FIFE::IGUIManager.

Definition at line 266 of file fifechanmanager.cpp.

References m_fcn_gui, and m_logic_executed.

Member Data Documentation

Console* FIFE::FifechanManager::m_console
private
GuiFont* FIFE::FifechanManager::m_defaultfont
private

Definition at line 170 of file fifechanmanager.h.

Referenced by getDefaultFont(), and setDefaultFont().

fcn::Gui* FIFE::FifechanManager::m_fcn_gui
private

Definition at line 156 of file fifechanmanager.h.

Referenced by FifechanManager(), getFifechanGUI(), init(), turn(), and ~FifechanManager().

fcn::Container* FIFE::FifechanManager::m_fcn_topcontainer
private
fcn::FocusHandler* FIFE::FifechanManager::m_focushandler
private

Definition at line 160 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

std::string FIFE::FifechanManager::m_fontglyphs
private

Definition at line 182 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

std::string FIFE::FifechanManager::m_fontpath
private

Definition at line 181 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

std::vector<GuiFont*> FIFE::FifechanManager::m_fonts
private

Definition at line 172 of file fifechanmanager.h.

Referenced by createFont(), invalidateFonts(), releaseFont(), and ~FifechanManager().

int32_t FIFE::FifechanManager::m_fontsize
private

Definition at line 183 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

fcn::Graphics* FIFE::FifechanManager::m_gui_graphics
private

Definition at line 158 of file fifechanmanager.h.

Referenced by init(), and ~FifechanManager().

bool FIFE::FifechanManager::m_had_mouse
private

Definition at line 177 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

bool FIFE::FifechanManager::m_had_widget
private

Definition at line 178 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

GuiImageLoader* FIFE::FifechanManager::m_imgloader
private

Definition at line 164 of file fifechanmanager.h.

Referenced by FifechanManager(), and ~FifechanManager().

fcn::SDLInput* FIFE::FifechanManager::m_input
private

Definition at line 166 of file fifechanmanager.h.

Referenced by FifechanManager(), onSdlEvent(), and ~FifechanManager().

bool FIFE::FifechanManager::m_logic_executed
private

Definition at line 186 of file fifechanmanager.h.

Referenced by turn().

std::set<fcn::Widget*> FIFE::FifechanManager::m_widgets
private

Definition at line 174 of file fifechanmanager.h.

Referenced by add(), and remove().


The documentation for this class was generated from the following files: