FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
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...
 
void setConsoleEnabled (bool console)
 Enables the console, or not. More...
 
bool isConsoleEnabled () const
 Checks if the console is enabled, or not. More...
 
void setCursor (Cursor *cursor)
 Sets the cursor. More...
 
CursorgetCursor () const
 Gets the cursor. 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)
 
void setTabbingEnabled (bool tabbing)
 Sets tabbing enabled, or not. More...
 
bool isTabbingEnabled () const
 Checks if tabbing is enabled. More...
 
- 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
 
Cursorm_cursor
 
GuiFontm_defaultfont
 
std::vector< GuiFont * > m_fonts
 
std::set< fcn::Widget * > m_widgets
 
bool m_had_mouse
 
bool m_had_widget
 
int32_t m_lastMotionX
 
int32_t m_lastMotionY
 
std::string m_fontpath
 
std::string m_fontglyphs
 
int32_t m_fontsize
 
bool m_logic_executed
 
bool m_enabled_console
 
std::string m_backend
 

Additional Inherited Members

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

Detailed Description

Definition at line 67 of file fifechanmanager.h.

Constructor & Destructor Documentation

FIFE::FifechanManager::FifechanManager ( )
FIFE::FifechanManager::~FifechanManager ( )
virtual

Destructor.

Definition at line 85 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
widgetA pointer to the widget to add.

Definition at line 189 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 234 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 129 of file fifechanmanager.h.

Cursor* FIFE::FifechanManager::getCursor ( ) const
inline

Gets the cursor.

Returns
The pointer to the cursor class.

Definition at line 155 of file fifechanmanager.h.

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

Gets the default font.

Definition at line 163 of file fifechanmanager.h.

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 185 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 123 of file fifechanmanager.h.

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
backendThe GUI backend object to use
screenWidthwidth for the gui top container
screenHeightheight for the gui top container

Definition at line 211 of file fifechanmanager.cpp.

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

void FIFE::FifechanManager::invalidateFonts ( )

Definition at line 275 of file fifechanmanager.cpp.

References m_fonts.

Referenced by resizeTopContainer().

+ Here is the caller graph for this function:

bool FIFE::FifechanManager::isConsoleEnabled ( ) const

Checks if the console is enabled, or not.

Returns
True if the console is enabled, false otherwise.
See also
setConsoleEnabled, getConsole

Definition at line 207 of file fifechanmanager.cpp.

References m_enabled_console.

bool FIFE::FifechanManager::isTabbingEnabled ( ) const

Checks if tabbing is enabled.

Returns
True if tabbing is enabled, false otherwise.
See also
setTabbingEnabled

Definition at line 397 of file fifechanmanager.cpp.

References m_fcn_gui.

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 99 of file fifechanmanager.cpp.

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

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

Releases given font.

Definition at line 263 of file fifechanmanager.cpp.

References m_fonts.

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

Removes a widget.

Parameters
widgetA pointer to the widget to remove.

Definition at line 196 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 172 of file fifechanmanager.cpp.

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

Referenced by init().

+ Here is the caller graph for this function:

void FIFE::FifechanManager::setConsoleEnabled ( bool  console)

Enables the console, or not.

Parameters
consoleTrue if the console should be enabled, false otherwise.
See also
isConsoleEnabled, getConsole

Definition at line 203 of file fifechanmanager.cpp.

References m_enabled_console.

void FIFE::FifechanManager::setCursor ( Cursor cursor)
inline

Sets the cursor.

Parameters
cursorThe pointer to the cursor class.

Definition at line 149 of file fifechanmanager.h.

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

Set the global font properties.

Definition at line 283 of file fifechanmanager.cpp.

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

void FIFE::FifechanManager::setTabbingEnabled ( bool  tabbing)

Sets tabbing enabled, or not.

Tabbing is the usage of changing focus by utilising the tab key.

Parameters
tabbingTrue if tabbing should be enabled, false otherwise.
See also
isTabbingEnabled

Definition at line 393 of file fifechanmanager.cpp.

References m_fcn_gui.

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 297 of file fifechanmanager.cpp.

References m_fcn_gui, and m_logic_executed.

Member Data Documentation

std::string FIFE::FifechanManager::m_backend
private

Definition at line 241 of file fifechanmanager.h.

Referenced by init(), and resizeTopContainer().

Console* FIFE::FifechanManager::m_console
private

Definition at line 214 of file fifechanmanager.h.

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

Cursor* FIFE::FifechanManager::m_cursor
private

Definition at line 216 of file fifechanmanager.h.

GuiFont* FIFE::FifechanManager::m_defaultfont
private

Definition at line 218 of file fifechanmanager.h.

Referenced by setDefaultFont().

bool FIFE::FifechanManager::m_enabled_console
private

Definition at line 239 of file fifechanmanager.h.

Referenced by init(), isConsoleEnabled(), and setConsoleEnabled().

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

Definition at line 206 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

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

Definition at line 233 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

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

Definition at line 232 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

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

Definition at line 220 of file fifechanmanager.h.

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

int32_t FIFE::FifechanManager::m_fontsize
private

Definition at line 234 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

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

Definition at line 204 of file fifechanmanager.h.

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

bool FIFE::FifechanManager::m_had_mouse
private

Definition at line 225 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

bool FIFE::FifechanManager::m_had_widget
private

Definition at line 226 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

GuiImageLoader* FIFE::FifechanManager::m_imgloader
private

Definition at line 210 of file fifechanmanager.h.

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

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

Definition at line 212 of file fifechanmanager.h.

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

int32_t FIFE::FifechanManager::m_lastMotionX
private

Definition at line 228 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

int32_t FIFE::FifechanManager::m_lastMotionY
private

Definition at line 229 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

bool FIFE::FifechanManager::m_logic_executed
private

Definition at line 237 of file fifechanmanager.h.

Referenced by turn().

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

Definition at line 222 of file fifechanmanager.h.

Referenced by add(), and remove().


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