FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#include <fifechanmanager.h>
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... | |
Console * | getConsole () 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... | |
Cursor * | getCursor () const |
Gets the cursor. More... | |
GuiFont * | setDefaultFont (const std::string &path, uint32_t size, const std::string &glyphs) |
Set the global font properties. More... | |
GuiFont * | getDefaultFont () |
Gets the default font. More... | |
GuiFont * | createFont (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 |
GuiImageLoader * | m_imgloader |
fcn::SDLInput * | m_input |
Console * | m_console |
Cursor * | m_cursor |
GuiFont * | m_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 FifechanManager * | instance () |
Protected Member Functions inherited from FIFE::IListener | |
IListener () | |
Definition at line 67 of file fifechanmanager.h.
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, m_input, m_lastMotionX, and m_lastMotionY.
|
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.
void FIFE::FifechanManager::add | ( | fcn::Widget * | widget | ) |
Adds a new widget.
widget | A 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().
|
staticprotected |
Definition at line 401 of file fifechanmanager.cpp.
References FIFE::Key::ALT_GR, FIFE::Key::BACKSPACE, FIFE::Key::CAPS_LOCK, FIFE::Key::DELETE, FIFE::Key::DOWN, FIFE::Key::END, FIFE::Key::ENTER, FIFE::Key::ESCAPE, FIFE::Key::F1, FIFE::Key::F10, FIFE::Key::F11, FIFE::Key::F12, FIFE::Key::F13, FIFE::Key::F14, FIFE::Key::F15, FIFE::Key::F2, FIFE::Key::F3, FIFE::Key::F4, FIFE::Key::F5, FIFE::Key::F6, FIFE::Key::F7, FIFE::Key::F8, FIFE::Key::F9, FIFE::Key::HOME, FIFE::Key::INSERT, FIFE::Key::LEFT, FIFE::Key::LEFT_ALT, FIFE::Key::LEFT_CONTROL, FIFE::Key::LEFT_SHIFT, FIFE::Key::LEFT_SUPER, FIFE::Key::NUM_LOCK, FIFE::Key::PAGE_DOWN, FIFE::Key::PAGE_UP, FIFE::Key::PAUSE, FIFE::Key::PRINT_SCREEN, FIFE::Key::RIGHT, FIFE::Key::RIGHT_ALT, FIFE::Key::RIGHT_CONTROL, FIFE::Key::RIGHT_SHIFT, FIFE::Key::RIGHT_SUPER, FIFE::Key::SCROLL_LOCK, FIFE::Key::SPACE, FIFE::Key::TAB, and FIFE::Key::UP.
Referenced by translateKeyEvent().
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().
|
inline |
|
inline |
Gets the cursor.
Definition at line 155 of file fifechanmanager.h.
|
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.
Definition at line 185 of file fifechanmanager.cpp.
References m_fcn_gui.
|
inline |
Gets the top container.
Definition at line 123 of file fifechanmanager.h.
Referenced by FIFE::Console::doShow().
void FIFE::FifechanManager::init | ( | const std::string & | backend, |
int32_t | screenWidth, | ||
int32_t | screenHeight | ||
) |
Inits the Fifechan GUI Manager.
backend | The GUI backend object to use |
screenWidth | width for the gui top container |
screenHeight | height 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().
bool FIFE::FifechanManager::isConsoleEnabled | ( | ) | const |
Checks if the console is enabled, or not.
Definition at line 207 of file fifechanmanager.cpp.
References m_enabled_console.
bool FIFE::FifechanManager::isTabbingEnabled | ( | ) | const |
Checks if tabbing is enabled.
Definition at line 397 of file fifechanmanager.cpp.
References m_fcn_gui.
|
virtual |
Called when an SDL event is received from SDL.
evt | SDL 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 | ) |
void FIFE::FifechanManager::remove | ( | fcn::Widget * | widget | ) |
Removes a widget.
widget | A 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().
|
virtual |
Resizes the top container.
x | The new starting X coordinate. |
y | The new starting Y coordinate. |
width | The new width. |
height | The 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().
void FIFE::FifechanManager::setConsoleEnabled | ( | bool | console | ) |
Enables the console, or not.
console | True if the console should be enabled, false otherwise. |
Definition at line 203 of file fifechanmanager.cpp.
References m_enabled_console.
|
inline |
Sets the cursor.
cursor | The 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.
tabbing | True if tabbing should be enabled, false otherwise. |
Definition at line 393 of file fifechanmanager.cpp.
References m_fcn_gui.
KeyEvent FIFE::FifechanManager::translateKeyEvent | ( | const fcn::KeyEvent & | evt | ) |
Definition at line 304 of file fifechanmanager.cpp.
References FIFE::_log, convertFifechanKeyToFifeKey(), FL_WARN, FIFE::KeyEvent::PRESSED, FIFE::KeyEvent::RELEASED, FIFE::KeyEvent::setAltPressed(), FIFE::KeyEvent::setControlPressed(), FIFE::KeyEvent::setKey(), FIFE::KeyEvent::setMetaPressed(), FIFE::KeyEvent::setNumericPad(), FIFE::KeyEvent::setShiftPressed(), FIFE::KeyEvent::setType(), and FIFE::KeyEvent::UNKNOWN.
MouseEvent FIFE::FifechanManager::translateMouseEvent | ( | const fcn::MouseEvent & | evt | ) |
Definition at line 329 of file fifechanmanager.cpp.
References FIFE::MouseEvent::CLICKED, FIFE::MouseEvent::DRAGGED, FIFE::MouseEvent::ENTERED, FIFE::MouseEvent::EXITED, FIFE::MouseEvent::LEFT, FIFE::MouseEvent::MIDDLE, FIFE::MouseEvent::MOVED, FIFE::MouseEvent::PRESSED, FIFE::MouseEvent::RELEASED, FIFE::MouseEvent::RIGHT, FIFE::MouseEvent::setAltPressed(), FIFE::MouseEvent::setButton(), FIFE::MouseEvent::setControlPressed(), FIFE::MouseEvent::setMetaPressed(), FIFE::MouseEvent::setShiftPressed(), FIFE::MouseEvent::setType(), FIFE::MouseEvent::setX(), FIFE::MouseEvent::setY(), FIFE::MouseEvent::UNKNOWN_BUTTON, FIFE::MouseEvent::UNKNOWN_EVENT, FIFE::MouseEvent::WHEEL_MOVED_DOWN, FIFE::MouseEvent::WHEEL_MOVED_UP, FIFE::MouseEvent::X1, and FIFE::MouseEvent::X2.
|
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.
|
private |
Definition at line 241 of file fifechanmanager.h.
Referenced by init(), and resizeTopContainer().
|
private |
Definition at line 214 of file fifechanmanager.h.
Referenced by init(), resizeTopContainer(), setDefaultFont(), and ~FifechanManager().
|
private |
Definition at line 216 of file fifechanmanager.h.
|
private |
Definition at line 218 of file fifechanmanager.h.
Referenced by setDefaultFont().
|
private |
Definition at line 239 of file fifechanmanager.h.
Referenced by init(), isConsoleEnabled(), and setConsoleEnabled().
|
private |
Definition at line 202 of file fifechanmanager.h.
Referenced by FifechanManager(), getFifechanGUI(), init(), isTabbingEnabled(), setTabbingEnabled(), turn(), and ~FifechanManager().
|
private |
Definition at line 208 of file fifechanmanager.h.
Referenced by add(), FifechanManager(), onSdlEvent(), remove(), resizeTopContainer(), and ~FifechanManager().
|
private |
Definition at line 206 of file fifechanmanager.h.
Referenced by FifechanManager(), and onSdlEvent().
|
private |
Definition at line 233 of file fifechanmanager.h.
Referenced by createFont(), and setDefaultFont().
|
private |
Definition at line 232 of file fifechanmanager.h.
Referenced by createFont(), and setDefaultFont().
|
private |
Definition at line 220 of file fifechanmanager.h.
Referenced by createFont(), invalidateFonts(), releaseFont(), and ~FifechanManager().
|
private |
Definition at line 234 of file fifechanmanager.h.
Referenced by createFont(), and setDefaultFont().
|
private |
Definition at line 204 of file fifechanmanager.h.
Referenced by init(), resizeTopContainer(), and ~FifechanManager().
|
private |
Definition at line 225 of file fifechanmanager.h.
Referenced by FifechanManager(), and onSdlEvent().
|
private |
Definition at line 226 of file fifechanmanager.h.
Referenced by FifechanManager(), and onSdlEvent().
|
private |
Definition at line 210 of file fifechanmanager.h.
Referenced by FifechanManager(), and ~FifechanManager().
|
private |
Definition at line 212 of file fifechanmanager.h.
Referenced by FifechanManager(), onSdlEvent(), and ~FifechanManager().
|
private |
Definition at line 228 of file fifechanmanager.h.
Referenced by FifechanManager(), and onSdlEvent().
|
private |
Definition at line 229 of file fifechanmanager.h.
Referenced by FifechanManager(), and onSdlEvent().
|
private |
Definition at line 237 of file fifechanmanager.h.
Referenced by turn().
|
private |
Definition at line 222 of file fifechanmanager.h.