GameData Class
Game Framework is deprecated and no longer supported. We can't guarantee the stable work of the framework.
Provides an access to the game data.
The GameData class implementation can be found in the data/framework/game/game_data.h file.
GameData Class
Members
void setCopyright(string copyright)
Adds a copyright information.Arguments
- string copyright - Copyright information.
string getCopyright ()
Returns a copyright information.Return value
Copyright information.void setDescription(string description)
Adds a game description.Arguments
- string description - Game description.
string getDescription ()
Returns a game description.Return value
Game description.void setDeveloper(string developer)
Adds an information about the game developer.Arguments
- string developer - Information about the game developer
string getDeveloper ()
Returns an information about the game developer.Return value
Information about the game developer.EntityData getEntity(variable index)
Returns an entity by the index.Arguments
- variable index - Entity number if index is an integer; entity name if index is a string.
Return value
Entity data.void setEntityPropertyFile(string file)
Sets a path to the property file of the basic entity.Arguments
- string file - Path to the property file.
string getEntityPropertyFile (int is_absolute = false)
Returns a path to the property file of the basic entity.Arguments
- int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.
Return value
Path to the property file.void setGameFile(string path)
Sets a path to the game file.Arguments
- string path - Relative path to the *.game file.
string getGameFile(int is_absolute = false)
Returns a path to the game file relative to data_path.Arguments
- int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.
Return value
Path to the *.game file.string getGamePath(int is_absolute = false)
Returns a path to the game file folder relative to data_path.Arguments
- int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.
Return value
Path to the game file folder.LevelData getLevel(variable index)
Returns LevelData by index.Arguments
- variable index - Level number if index is an integer; level name if index is a string.
Return value
LevelData.void setName(string name)
Sets a game name.Arguments
- string name - Game name.
string getName ()
Returns a game name.Return value
Game name.int getNumEntities()
Returns the number of game entities.Return value
Number of game entities.int getNumLevels ()
Returns the number of game levels.Return value
Number of game levels.void setPropertiesListFile(string path)
Sets a path to the file of the game properties.Arguments
- string path - Path to the game properties file.
string getPropertiesListFile (int is_absolute = false)
Returns a path to the file of the game properties.Arguments
- int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.
Return value
Path to the game properties file.void setVersion(string version)
Adds an information about the game version.Arguments
- string version - Information about the game version
string getVersion ()
Returns a game version.Return value
Game version.void setWindowTitle(string window_title)
Sets a title of the game window.Arguments
- string window_title - Game window title.
string getWindowTitle ()
Returns a title of the game window.Return value
Game window title.EntityData addEntity(string name)
Creates a new entity and adds it to the entities list.Arguments
- string name - Name of the new entity.
Return value
New entity.LevelData addLevel(string name)
Adds a new level to the game.Arguments
- string name - Name of the new level.
Return value
New level.GameData()
Constructor. Creates a new GameData class instance.void load(string file_name)
Loads game data from the file.Arguments
- string file_name - Path to the game file.
void loadData(Xml xml)
Reads game data from the Xml class instance.Arguments
- Xml xml - Game data.
void removeEntity(variable index)
Removes an entity by index.Arguments
- variable index - Entity number if index is an integer; entity name if index is a string.
void removeLevel(variable index)
Removes a level by index.Arguments
- variable index - Level number if index is an integer; level name if index is a string.
void save()
Saves game data to the *.game file.void saveData(Xml xml)
Writes game data to the Xml class instance.Arguments
- Xml xml - Instance of the Xml class to write game data.
Last update: 2017-10-20
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)