File interfaceService.hpp

class InterfaceService
#include <interfaceService.hpp>

The InterfaceService acts for the User Interface (UI).

Public Functions

InterfaceService()

Empty constructor.

~InterfaceService()
void initBin(GameData &bin)

Initialize this service with a GameBin.

Font getFont() const

Get the font used for the game’s UI.

void showDialogue(const std::string &id, bool runScript = true)

Open a dialogue with a certain title.

void showDialogue(const DialogueBin &dialogue, bool runScript = true)

Open the dialogue with a Dialogue structure

InterfaceView *getCurrentView()

Get the current active view.

void showInterface(const std::string &title, bool runScript = true)

Set this view as the current one and show it.

void hideInterface(bool runScript = true)

Hide the current view (no current view).

void setNotifyLock()
bool getNotifyLock()
KeyboardKey getLastKey()

Get the last pressed key.

void doFadeTransition()

Active a fade transition.

void updateFade()

Update transition routine.

void setTransitionPointCallback(std::function<void()> callback)

Set transition point callback.

void update()

Update routine.

void draw()

Draw routine.

void unload() const

Unload routine.

Public Static Functions

static ElementFactory &getFactory()

Get a reference to the factory helper.

Private Members

Font font

The loaded font that will be used for the User Interface.

bool fpsVisible
bool notifyLock = false
std::map<std::string, std::unique_ptr<InterfaceView>> views

Available UI Views.

std::string currentViewName

Current active view.

KeyboardKey lastKey = KEY_NULL

Last KeyboardKey.

int frameCounter

Frame counter for transition tween

bool transitionActive
Color transitionColor
float alpha
bool transitionSecondStage
std::function<void()> onTransitionPoint

Private Static Attributes

static ElementFactory factory

Helper for instantiating element types.