V-Gears 0
Free Final Fantasy VII engine.
DialogsManager Class Reference

The dialog manager. More...

#include <DialogsManager.h>

Inheritance diagram for DialogsManager:
Collaboration diagram for DialogsManager:

Public Member Functions

 DialogsManager ()
 Constructor. More...
 
virtual ~DialogsManager ()
 Destructor. More...
 
void Initialise ()
 Initializes the dialog manager. More...
 
void Input (const VGears::Event &event) override
 Processes an input event. More...
 
void UpdateDebug ()
 Updates the messagemanager with debug information. More...
 
void OnResize () override
 Handles resizing events. More...
 
void ClearField () override
 Clears all field messages. More...
 
void ClearBattle () override
 Clears all battle messages. More...
 
void ClearWorld () override
 Clears all world map maeeages. More...
 
void OpenDialog (const char *d_name, int x, int y, int w, int h)
 Opens a dialog. More...
 
void SetText (const char *d_name, const char *text)
 Sets the text of a dialog. More...
 
void SetNumeric (const char *d_name, const bool numeric, const bool timer)
 Sets or unsets a dialog window as numeric. More...
 
void UpdateTimer (const unsigned int seconds)
 Updates the timer. More...
 
void SetMode (const char *d_name, const int bg, const bool closeable)
 Sets the window mode. More...
 
int Sync (const char *d_name)
 Syncs the dialog and makes the script wait until it is closed. More...
 
void Hide (const char *d_name)
 Closes and hides a dialog window. More...
 
void SetVariable (const char *d_name, const char *name, const char *value)
 Sets a variable in a dialog. More...
 
void SetClickable (const char *d_name, const bool clickable)
 Makes the dialog clickable or not. More...
 
void SetCursor (const char *d_name, const int first_row, const int last_row)
 Sets a choice sursor in the dialog. More...
 
int GetCursor (const char *d_name) const
 Gets the cursor position in a dialog. More...
 
void ScriptSetMapName (const char *text_id)
 Sets the map name from a text ID. More...
 
void SetMapName (std::string name)
 Sets the map name from a text ID. More...
 
std::string GetMapName ()
 Retrieves the current map name. More...
 
- Public Member Functions inherited from Manager
 Manager ()
 Constructor. More...
 
virtual ~Manager ()
 Destructor. More...
 
Module GetModule () const
 Retrieves the currently selected module. More...
 
bool IsModule (const Module module) const
 Checks the currently selected module. More...
 
bool IsFieldModule () const
 Checks if the currently selected module is the field module. More...
 
bool IsBattleModule () const
 Checks if the currently selected module is the battle module. More...
 
bool IsWorldModule () const
 Checks if the currently selected module is the world module. More...
 
void SetModule (const Module module)
 Sets the current module for the entity manager. More...
 
void SetFieldModule ()
 Sets the current module to the field mode. More...
 
void SetBattleModule ()
 Sets the current module to the battle mode. More...
 
void SetWorldModule ()
 Sets the current module to the world map mode. More...
 
void SetPreviousModule ()
 Sets the module that was loaded before a battle. More...
 
virtual void Input (const VGears::Event &event)=0
 Handles an input event. More...
 
void Update ()
 Called every frame, performs an update on the things controlled by the manager. More...
 
virtual void UpdateDebug ()=0
 Called every frame, performs an update on the things controlled by the manager. More...
 
virtual void OnResize ()=0
 Handles resizing events. More...
 
void Clear ()
 Clears the manager. More...
 
void Clear (const Module module)
 Clears the manager. More...
 
virtual void ClearField ()=0
 Clear all field information in the manager. More...
 
virtual void ClearBattle ()=0
 Clear all battle information in the manager. More...
 
virtual void ClearWorld ()=0
 Clear all world map information in the manager. More...
 
void ClearAll ()
 Clears the manager. More...
 
void ScriptSetPaused (const bool paused)
 Handles game pausing. More...
 

Private Member Functions

void UpdateField () override
 Updates the dialogs while in a field. More...
 
void UpdateBattle () override
 Updates the dialogs during a battle. More...
 
void UpdateWorld () override
 Updates the dialogs while on the world map. More...
 
void ShowMessage (const int id, const int x, const int y, const int width, const int height)
 Shows a message in a dialog. More...
 
void HideMessage (const int id)
 Closes and hides a message. More...
 
int GetMessageId (const char *d_name) const
 Retrieves a message Id from it's name. More...
 
bool AutoCloseCheck (const unsigned int id)
 Checks if a message is set to close automatically. More...
 

Private Attributes

UiWidgetlimit_area_
 The limit area for message boxes. More...
 
std::vector< MessageData * > messages_
 The list of messages for the field or the world map. More...
 
std::vector< MessageData * > battle_messages_
 The list of battle messages. More...
 
bool next_pressed_
 Indicates if the 'next' button has been pressed. More...
 
bool next_repeated_
 Indicates if the 'next' button is being hold. More...
 
bool up_pressed_
 Indicates if the 'up' button has been pressed. More...
 
bool down_pressed_
 Indicates if the 'down' button has been pressed. More...
 
std::string map_name_
 Current map name. More...
 
int timer_window_id_
 The ID of the window that contains the timer, is any. More...
 
unsigned int timer_seconds_
 The number of seconds in the timer. More...
 

Additional Inherited Members

- Public Types inherited from Manager
enum  Module { FIELD = 0 , BATTLE = 1 , WORLD = 2 }
 The modules the entity manager can handle. More...
 
- Protected Member Functions inherited from Manager
virtual void UpdateField ()=0
 Updates the field entities in the manager. More...
 
virtual void UpdateBattle ()=0
 Updates the battle entities in the manager. More...
 
virtual void UpdateWorld ()=0
 Updates the world map entities in the manager. More...
 
void Update (Module module)
 Updates the entities of one module in the manager. More...
 
- Protected Attributes inherited from Manager
Module module_
 The currently selected module. More...
 
Module prev_module_
 The previous module. More...
 
bool paused_
 Indicates if the game is paused. More...
 

Detailed Description

The dialog manager.

Constructor & Destructor Documentation

◆ DialogsManager()

DialogsManager::DialogsManager ( )

Constructor.

◆ ~DialogsManager()

DialogsManager::~DialogsManager ( )
virtual

Destructor.

Member Function Documentation

◆ AutoCloseCheck()

bool DialogsManager::AutoCloseCheck ( const unsigned int  id)
private

Checks if a message is set to close automatically.

Parameters
[in]idMessage ID.
Returns
True if the message is set to auto close, false otherwise.

◆ ClearBattle()

void DialogsManager::ClearBattle ( )
overridevirtual

Clears all battle messages.

Implements Manager.

◆ ClearField()

void DialogsManager::ClearField ( )
overridevirtual

Clears all field messages.

Implements Manager.

◆ ClearWorld()

void DialogsManager::ClearWorld ( )
overridevirtual

Clears all world map maeeages.

Implements Manager.

◆ GetCursor()

int DialogsManager::GetCursor ( const char *  d_name) const

Gets the cursor position in a dialog.

Parameters
[in]d_nameDialog name.
Returns
Position of the cursor in the dialog, including unselectable lines (0-index). 0 if the dialog doesn't exist.

◆ GetMapName()

std::string DialogsManager::GetMapName ( )

Retrieves the current map name.

Returns
The map name.

◆ GetMessageId()

int DialogsManager::GetMessageId ( const char *  d_name) const
private

Retrieves a message Id from it's name.

Parameters
[in]d_nameDialog name.
Returns
The dialog ID. -1 if there is no dialog by that name.

◆ Hide()

void DialogsManager::Hide ( const char *  d_name)

Closes and hides a dialog window.

Equivalent to dialog_close in the field scripts.

Parameters
[in]d_nameName of the dialog to close.

◆ HideMessage()

void DialogsManager::HideMessage ( const int  id)
private

Closes and hides a message.

Parameters
[in]idID of the message to close.

◆ Initialise()

void DialogsManager::Initialise ( )

Initializes the dialog manager.

◆ Input()

void DialogsManager::Input ( const VGears::Event event)
overridevirtual

Processes an input event.

Parameters
[in]eventEvent to process.

Implements Manager.

◆ OnResize()

void DialogsManager::OnResize ( )
overridevirtual

Handles resizing events.

Implements Manager.

◆ OpenDialog()

void DialogsManager::OpenDialog ( const char *  d_name,
int  x,
int  y,
int  w,
int  h 
)

Opens a dialog.

Equivalent to dialog_open in the field scripts.

Parameters
[in]d_nameThe dialog name. Can be used as ID.
[in]xX coordinate for the top left corner of the dialog.
[in]yY coordinate for the top left corner of the dialog.
[in]wWidth of the dialog, in pixels.
[in]hHeight of the dialog, in pixels.

◆ ScriptSetMapName()

void DialogsManager::ScriptSetMapName ( const char *  text_id)

Sets the map name from a text ID.

Parameters
[in]text_idThe ID of the text to set as map name.

◆ SetClickable()

void DialogsManager::SetClickable ( const char *  d_name,
const bool  clickable 
)

Makes the dialog clickable or not.

A clickable dialog presents a choice for the user that must be selected with a cursor.

Parameters
[in]d_nameName of the dialog.
[in]clickableTrue to make the dialog clickable, false to make it unclickable

◆ SetCursor()

void DialogsManager::SetCursor ( const char *  d_name,
const int  first_row,
const int  last_row 
)

Sets a choice sursor in the dialog.

Parameters
[in]d_nameName of the dialog.
[in]first_rowFirst selectable line.
[in]last_rowLast selectable line.

◆ SetMapName()

void DialogsManager::SetMapName ( std::string  name)

Sets the map name from a text ID.

Parameters
[in]nameThe new map name.

◆ SetMode()

void DialogsManager::SetMode ( const char *  d_name,
const int  bg,
const bool  closeable 
)

Sets the window mode.

Parameters
[in]d_nameName of the dialog.
[in]bgBackground mode. 1: No background/border. 2: Translucent background. Anything else: Normal.
[in]closeableTrue if the window can be closed manually, false to lock it.

◆ SetNumeric()

void DialogsManager::SetNumeric ( const char *  d_name,
const bool  numeric,
const bool  timer 
)

Sets or unsets a dialog window as numeric.

Parameters
[in]d_nameName of the dialog.
[in]numericTrue to make it numeric, false otherwise.
[in]timerTrue to use the window for times, false for regular numbers. If used for timer, the window will be used when calling {
See also
UpdateTimer}

◆ SetText()

void DialogsManager::SetText ( const char *  d_name,
const char *  text 
)

Sets the text of a dialog.

Equivalent to dialog_set_text in the field scripts.

Parameters
[in]d_nameName of the dialog.
[in]textText to set in the dialog.

◆ SetVariable()

void DialogsManager::SetVariable ( const char *  d_name,
const char *  name,
const char *  value 
)

Sets a variable in a dialog.

Parameters
[in]d_nameName of the dialog.
[in]nameName of the variable.
[in]valueValue for the variable.

◆ ShowMessage()

void DialogsManager::ShowMessage ( const int  id,
const int  x,
const int  y,
const int  width,
const int  height 
)
private

Shows a message in a dialog.

Parameters
[in]idMessage id.
[in]xX coordinate for the text in the dialog.
[in]yY coordinate for the text in the dialog.
[in]widthWidth of the text, in pixels.
[in]heightHeight of the text, in pixels.
Todo:
Is this a window-limit-aware version of SetText?

◆ Sync()

int DialogsManager::Sync ( const char *  d_name)

Syncs the dialog and makes the script wait until it is closed.

Equivalent to dialog_wait_for_close in the field scripts.

Parameters
[in]d_nameName of the dialog.
Returns
1 if the dialog doesn't exist, -1 otherwise.

◆ UpdateBattle()

void DialogsManager::UpdateBattle ( )
overrideprivatevirtual

Updates the dialogs during a battle.

Implements Manager.

◆ UpdateDebug()

void DialogsManager::UpdateDebug ( )
virtual

Updates the messagemanager with debug information.

Implements Manager.

◆ UpdateField()

void DialogsManager::UpdateField ( )
overrideprivatevirtual

Updates the dialogs while in a field.

Implements Manager.

◆ UpdateTimer()

void DialogsManager::UpdateTimer ( const unsigned int  seconds)

Updates the timer.

Displays the formatted time in the timer window. To do so, a timer window must have been set as timer with {

See also
SetNumeric}

◆ UpdateWorld()

void DialogsManager::UpdateWorld ( )
overrideprivatevirtual

Updates the dialogs while on the world map.

Implements Manager.

Member Data Documentation

◆ battle_messages_

std::vector<MessageData*> DialogsManager::battle_messages_
private

The list of battle messages.

◆ down_pressed_

bool DialogsManager::down_pressed_
private

Indicates if the 'down' button has been pressed.

◆ limit_area_

UiWidget* DialogsManager::limit_area_
private

The limit area for message boxes.

◆ map_name_

std::string DialogsManager::map_name_
private

Current map name.

◆ messages_

std::vector<MessageData*> DialogsManager::messages_
private

The list of messages for the field or the world map.

◆ next_pressed_

bool DialogsManager::next_pressed_
private

Indicates if the 'next' button has been pressed.

◆ next_repeated_

bool DialogsManager::next_repeated_
private

Indicates if the 'next' button is being hold.

◆ timer_seconds_

unsigned int DialogsManager::timer_seconds_
private

The number of seconds in the timer.

Stored solely to not re-set the text if the time is the same.

◆ timer_window_id_

int DialogsManager::timer_window_id_
private

The ID of the window that contains the timer, is any.

◆ up_pressed_

bool DialogsManager::up_pressed_
private

Indicates if the 'up' button has been pressed.


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