Class InterfaceView¶
-
class InterfaceView : public ISaveable¶
An InterfaceView represents a collection of UI elements drawn on the screen to make up a user interface.
Subclassed by DialogueInterfaceView
Public Functions
-
InterfaceView()¶
Default constructor.
-
InterfaceView(const std::string &filePath)¶
Construct from a UI View file.
-
InterfaceView(InterfaceViewBin &bin)¶
Construct from binary data.
-
virtual nlohmann::json dumpJson()¶
Dump json data.
-
const std::string &getEntityName(int index)¶
Get name of an element by index.
-
ElementIndex findByName(const std::string &title)¶
Get the index of an element identified by its name.
-
bool elementExists(const std::string &title)¶
Whether an element with such a name exists.
-
ElementIndex addElement(const std::string &title, const std::string &type)¶
Add an element with a title and a registered type.
-
void removeElement(const std::string &title)¶
Remove an element by its title.
-
UIElement *getElement(ElementIndex i)¶
Get an element pointer by its index.
-
void renameElement(const std::string &title, const std::string &newTitle)¶
Rename an element.
-
void changeFocusedElement(const std::string &title)¶
Change the focus to an element identified by its index.
-
void changeFocusedElement(ElementIndex index)¶
Change the focus to an element identified by an index.
-
UIElement *cloneElement(const std::string &title, const std::string &newTitle)¶
Clone an element by giving it a title. It will appear right above the element that was cloned.
-
const std::array<std::unique_ptr<UIElement>, MAX_ELEMENTS> &getElements()¶
Get an array of the elements.
-
void swapElements(ElementIndex a, ElementIndex b)¶
Swap two elements.
-
void moveToPosition(ElementIndex source, ElementIndex dest)¶
Move an element to another position within the array.
-
void resetElements()¶
Reset the elements’ positions and sizes.
-
ElementIndex getSize()¶
Get the amount of elements within this View.
-
virtual void update()¶
Update routine.
-
virtual void draw()¶
Draw routine. Draws all the elements.
-
virtual void drawEntity(ElementIndex i)¶
Draw a specific element.
-
void setScriptFile(const std::string &fileName)¶
Set the script file for this UI View.
-
std::string getScriptFile()¶
Get the path to the script file for this UI View.
-
bool hasScript()¶
Check whether this View has an attached script or not.
-
sol::environment &getLuaEnvironment()¶
Get a reference to the Lua environment of this View.
-
std::list<TweenContainer> &getTweens()¶
Get a reference to the list of running tweens.
-
void addTweenContainer(TweenContainer tweenContainer)¶
Add a tween container to be animated.
-
void abandonLua()¶
Abandon the Lua environment. Should always be done before the end of the program.
Public Members
-
bool runScript = true¶
Flag whether the script should be ran.
-
InterfaceView()¶