FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
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::IListener
virtual bool isActive ()
 Indicates if the listener is active. More...
 
virtual void setActive (bool active)
 Changes the listener status. More...
 
virtual ~IListener ()
 
- 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 ()
 
- Protected Member Functions inherited from FIFE::IListener
 IListener ()
 

Detailed Description

Definition at line 67 of file fifechanmanager.h.

Constructor & Destructor Documentation

◆ FifechanManager()

FIFE::FifechanManager::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

◆ add()

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:

◆ convertFifechanKeyToFifeKey()

◆ createFont()

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:

◆ getConsole()

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

Gets the console.

Returns
The console.

Definition at line 129 of file fifechanmanager.h.

◆ getCursor()

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

Gets the cursor.

Returns
The pointer to the cursor class.

Definition at line 155 of file fifechanmanager.h.

◆ getDefaultFont()

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

Gets the default font.

Definition at line 163 of file fifechanmanager.h.

◆ getFifechanGUI()

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.

◆ getTopContainer()

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:

◆ init()

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().

◆ invalidateFonts()

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:

◆ isConsoleEnabled()

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.

◆ isTabbingEnabled()

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.

◆ onSdlEvent()

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.

◆ releaseFont()

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

Releases given font.

Definition at line 263 of file fifechanmanager.cpp.

References m_fonts.

◆ remove()

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:

◆ resizeTopContainer()

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:

◆ setConsoleEnabled()

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.

◆ setCursor()

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.

◆ setDefaultFont()

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().

◆ setTabbingEnabled()

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.

◆ translateKeyEvent()

◆ translateMouseEvent()

◆ turn()

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

◆ m_backend

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

Definition at line 241 of file fifechanmanager.h.

Referenced by init(), and resizeTopContainer().

◆ m_console

Console* FIFE::FifechanManager::m_console
private

Definition at line 214 of file fifechanmanager.h.

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

◆ m_cursor

Cursor* FIFE::FifechanManager::m_cursor
private

Definition at line 216 of file fifechanmanager.h.

◆ m_defaultfont

GuiFont* FIFE::FifechanManager::m_defaultfont
private

Definition at line 218 of file fifechanmanager.h.

Referenced by setDefaultFont().

◆ m_enabled_console

bool FIFE::FifechanManager::m_enabled_console
private

Definition at line 239 of file fifechanmanager.h.

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

◆ m_fcn_gui

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

◆ m_fcn_topcontainer

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

◆ m_focushandler

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

Definition at line 206 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

◆ m_fontglyphs

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

Definition at line 233 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

◆ m_fontpath

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

Definition at line 232 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

◆ m_fonts

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

Definition at line 220 of file fifechanmanager.h.

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

◆ m_fontsize

int32_t FIFE::FifechanManager::m_fontsize
private

Definition at line 234 of file fifechanmanager.h.

Referenced by createFont(), and setDefaultFont().

◆ m_gui_graphics

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

Definition at line 204 of file fifechanmanager.h.

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

◆ m_had_mouse

bool FIFE::FifechanManager::m_had_mouse
private

Definition at line 225 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

◆ m_had_widget

bool FIFE::FifechanManager::m_had_widget
private

Definition at line 226 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

◆ m_imgloader

GuiImageLoader* FIFE::FifechanManager::m_imgloader
private

Definition at line 210 of file fifechanmanager.h.

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

◆ m_input

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

Definition at line 212 of file fifechanmanager.h.

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

◆ m_lastMotionX

int32_t FIFE::FifechanManager::m_lastMotionX
private

Definition at line 228 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

◆ m_lastMotionY

int32_t FIFE::FifechanManager::m_lastMotionY
private

Definition at line 229 of file fifechanmanager.h.

Referenced by FifechanManager(), and onSdlEvent().

◆ m_logic_executed

bool FIFE::FifechanManager::m_logic_executed
private

Definition at line 237 of file fifechanmanager.h.

Referenced by turn().

◆ m_widgets

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: