The text handler.
More...
#include <TextHandler.h>
◆ TextHandler()
TextHandler::TextHandler |
( |
| ) |
|
◆ ~TextHandler()
TextHandler::~TextHandler |
( |
| ) |
|
|
virtual |
◆ AddDialog()
void TextHandler::AddDialog |
( |
const Ogre::String & |
name, |
|
|
TiXmlNode * |
node, |
|
|
const float |
width, |
|
|
const float |
height |
|
) |
| |
Adds a text dialog.
- Parameters
-
[in] | name | Text name or identifier. |
[in] | node | Text node in an XML file. |
[in] | width | Text width. |
[in] | height | Text height. |
◆ AddText()
void TextHandler::AddText |
( |
const Ogre::String & |
name, |
|
|
TiXmlNode * |
node |
|
) |
| |
Adds text.
- Parameters
-
[in] | name | Text name or identifier. |
[in] | node | Text node in an XML file. |
◆ GetCharacterName()
std::string TextHandler::GetCharacterName |
( |
int |
id | ) |
|
Retrieves a character name from it's ID.
- Parameters
-
[in] | id | ID of the character. |
- Returns
- The name of the character. If the character doesn't exist, "UNKNOWN_CHAR_" + id will be returned.
◆ GetDialog()
TiXmlNode * TextHandler::GetDialog |
( |
const Ogre::String & |
name, |
|
|
float & |
width, |
|
|
float & |
height |
|
) |
| const |
Retrieves a dialog and it's dimensions by name.
- Parameters
-
[in] | name | Text name or identifier. |
[out] | width | The text width will be saved here. It won't change if the dialog is not found. |
[out] | height | The text height will be saved here. It won't change if the dialog is not found. |
- Returns
- Text node in an XML file, or NULL if there is none.
◆ GetDialogText()
std::string TextHandler::GetDialogText |
( |
const std::string |
name | ) |
|
Retrieves a dialog text by name.
- Parameters
-
[in] | name | Text name or identifier. |
- Returns
- Dialog text, an empty string if there is none by the specified ID.
◆ GetLanguage()
const Ogre::String & TextHandler::GetLanguage |
( |
| ) |
|
Retrieves the currently set language.
- Returns
- The current language.
◆ GetParty()
std::vector< int > TextHandler::GetParty |
( |
| ) |
|
Retrieves the party member IDs.
- Returns
- The list of party member IDs.
◆ GetPartyCharacterName()
std::string TextHandler::GetPartyCharacterName |
( |
int |
position | ) |
|
Retrieves a character name from it's party position.
- Parameters
-
[in] | position | Position in the party[1-3]. |
- Returns
- The name of the character in the party specified position. If an invalid position is supplied, "UNKNOWN_PARTY_POS_" + id will be returned. If the position is correct, but there is no character on it, an empty string will be returned.
◆ GetText()
TiXmlNode * TextHandler::GetText |
( |
const Ogre::String & |
name | ) |
const |
Retrieves a text by name.
- Parameters
-
[in] | name | Text name or identifier. |
- Returns
- Text node in an XML file, or NULL if there is none.
◆ InitCmd()
void TextHandler::InitCmd |
( |
| ) |
|
Initializes the commands for the text handler.
◆ LoadFieldText()
void TextHandler::LoadFieldText |
( |
const std::string |
field_name | ) |
|
Loads texts for a specific field.
- Parameters
-
[in] | field_name | Name of the field. |
◆ SetCharacterName()
void TextHandler::SetCharacterName |
( |
int |
id, |
|
|
char * |
name |
|
) |
| |
Sets a character name.
- Parameters
-
◆ SetLanguage()
void TextHandler::SetLanguage |
( |
const Ogre::String & |
language | ) |
|
Sets the language for texts.
- Parameters
-
[in] | language | Language identifier. Must be the name of one of the folders in the data/text/. |
◆ SetParty()
void TextHandler::SetParty |
( |
int |
char_1, |
|
|
int |
char_2, |
|
|
int |
char_3 |
|
) |
| |
Sets the party member IDs.
- Parameters
-
[in] | char_1 | First member id. |
[in] | char_2 | Second member id. -1 if not set. |
[in] | char_3 | Third member id. -1 if not set. |
◆ UnloadTexts()
void TextHandler::UnloadTexts |
( |
| ) |
|
Deletes all texts in the handler.
◆ character_names_
std::string TextHandler::character_names_[11] |
|
private |
Character names, indexed by character IDs.
Sometimes, character names must appear in texts. This must be refreshed on engine start and when a character name changes.
◆ current_party_
int TextHandler::current_party_[3] |
|
private |
Current party formation.
Sometimes, the name of a character in the party must appear in texts. This holds the current party member IDs (or -1 if the party is not full). It must be refreshed every time the party changes.
◆ dialogs_
std::vector<Dialog> TextHandler::dialogs_ |
|
private |
The list of dialogs in the handler.
◆ language_
Ogre::String TextHandler::language_ |
|
private |
The language for the texts.
◆ texts_
std::vector<Text> TextHandler::texts_ |
|
private |
The list of texts in the handler.
The documentation for this class was generated from the following files: