#include <game.h>
Creation methods | |
| Since this is a singlton, we use an instance for all our calls. | |
| ~CGame () | |
| eError | init () |
| Setup with starting values. | |
| static CGame * | instance () |
| |
Public Types | |
Enum values | |
| enum | eError { kNoError = 0, kNoEnt = -1, kBadValue = -2, kCantFindInLevel = -3, kEnumOutOfRange = -4, kBadType = -5, kBadLevel = -6, kCantStart = -7, kNullPtr = -8, kNullEntPtr = -9 } |
| Error code enums. More... | |
Public Member Functions | |
| void | fx_update () |
| Update managed FX. | |
Level methods | |
| bool | level_valid (int i=-1) const |
| Is the current level valid? | |
| bool | level_switch (const int i=0) |
| Switch the current level. | |
| bool | level_next () |
| Go to the next valid level. | |
| int | level_update () |
| Update the current level. | |
| bool | level_remove (int i=-1) |
| Remove the current level from the game. | |
| int | level_count () const |
| Return the number of user levels in this game instance. | |
| int | level_current () |
| Return the current level. | |
GameEntity methods | |
| int | ge_focus (CGameEntity *pGE) |
| Set the current focus entity. | |
| CGameEntity * | ge_focus () |
| Get the current focus entity. | |
| CGameEntity * | ge_ptr (ENTITY *pEnt) |
| Get a pointer to any GameEntity associated with the ENTITY* passed in. | |
| CGameEntity * | ge_ptr (const long id) |
| Get a GE using its id number. | |
Level Objects methods | |
| long | object_add (ENTITY *pEnt) |
| Add an entity object to the current level. | |
| long | object_add (CGameEntity *pGE) |
| Add a GE to the current level. | |
| bool | object_valid (ENTITY *pEnt) const |
| Is this a valid GE? | |
| void | object_remove (ENTITY *pEnt) |
| Remove an entity from the current level. | |
| void | object_remove (long id) |
| Remove an entity from the current level. | |
| int | object_add_cmp (ENTITY *pEnt, int type) |
| Add a component to the entity. | |
| int | object_cmp_set (ENTITY *pEnt, eCmp cmp, const EDIT_DATA &data) |
| Set an entity's property. | |
| int | object_set (ENTITY *pEnt, const EDIT_DATA &editData) |
| Set an entity's property. | |
| int | object_get (ENTITY *pEnt, EDIT_DATA &editData) |
| Get a value from an entity. | |
| int | object_get (ENTITY *pEnt, eCmp cmpType, EDIT_DATA &editData) |
| Get a value from an entity. | |
| int | object_get (const long id, EDIT_DATA &editData) |
| Get a value from an entity. | |
| int | object_act (ENTITY *pEnt, const ACTION_DATA &actData) |
| Act on an entity (do damage, activate, etc.). | |
| int | object_act (ENTITY *pEnt, eCmp cmpType, const ACTION_DATA &data) |
| Act on an entity (do damage, activate, etc.). | |
| bool | event_set_data (const T7EVENT_DATA &data) |
| \ name Event methods | |
| bool | event_get_data (T7EVENT_DATA &data) |
| Get event data. | |
| bool | event_get_data (T7EVENT_DATA &data, const int event_type) |
| Get event data. | |
Camera methods | |
| bool | camera_add (CCameraBase *cam) |
| Add a global camera. | |
| bool | camera_add (int type) |
| Add a global camera. | |
| bool | camera_set_target (ENTITY *ent, float x, float y, float z) |
| Change the target entity for the cameras. | |
EntityData methods | |
| int | entityData_count () |
| Return the number of base behavior in this game instance. | |
| bool | entityData_load (const char *filename, const char *path=NULL) |
| Load in the behavior description from a file. | |
| bool | entityData_valid (const char *str) |
| Is the data named valid? | |
| CGameEntityData * | entityData_get (const char *str) |
| |
User Interface methods | |
| bool | ui_add (CUi *pUi) |
| Add a UI object to this level. | |
| bool | ui_add (eUI type) |
| Create and add a UI object to this level. | |
| void | ui_update () |
| Update the UI. | |
Static Public Member Functions | |
Static methods | |
Can be called directly using CGame::func(..) | |
| static void | remove () |
| Remove the current instance. | |
| static bool | update () |
| Update the game for one frame. | |
| static bool | load (const std::string &filename) |
| Load in the game description from a file. | |
Protected Member Functions | |
| CGame () | |
| Protected constructor (use "instance()" to create). | |
(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.
| enum CGame::eError |
Error code enums.
| CGame::CGame | ( | ) | [protected] |
| bool CGame::update | ( | ) | [static] |
Update the game for one frame.
| bool CGame::load | ( | const std::string & | filename | ) | [static] |
Load in the game description from a file.
| filename | Name of the file containing game description |
| bool CGame::level_valid | ( | int | i = -1 |
) | const [inline] |
Is the current level valid?
| i | Level to check (default to current level: -1) |
| bool CGame::level_switch | ( | const int | i = 0 |
) |
Switch the current level.
| bool CGame::level_next | ( | ) |
Go to the next valid level.
| int CGame::level_update | ( | ) |
Update the current level.
| bool CGame::level_remove | ( | int | i = -1 |
) |
Remove the current level from the game.
| i | Level to be removed (default to current level: -1) |
| int CGame::level_count | ( | ) | const [inline] |
Return the number of user levels in this game instance.
| int CGame::level_current | ( | ) | [inline] |
Return the current level.
| int CGame::ge_focus | ( | CGameEntity * | pGE | ) | [inline] |
Set the current focus entity.
| pGE | Pointer to a Game Entity |
| CGameEntity* CGame::ge_focus | ( | ) | [inline] |
Get the current focus entity.
| CGameEntity* CGame::ge_ptr | ( | ENTITY * | pEnt | ) | [inline] |
Get a pointer to any GameEntity associated with the ENTITY* passed in.
| pEnt | Pointer to ENTITY we are searching for |
| CGameEntity* CGame::ge_ptr | ( | const long | id | ) | [inline] |
Get a GE using its id number.
| long CGame::object_add | ( | ENTITY * | pEnt | ) |
Add an entity object to the current level.
| pEnt | Pointer to ENTITY to be added. |
| long CGame::object_add | ( | CGameEntity * | pGE | ) |
Add a GE to the current level.
| pGE | Point to the CGameEntity to be added. |
| bool CGame::object_valid | ( | ENTITY * | pEnt | ) | const |
Is this a valid GE?
| pEnt | Pointer to an ENTITY we are checking for. |
| void CGame::object_remove | ( | ENTITY * | pEnt | ) |
Remove an entity from the current level.
| pEnt | Pointer to ENTITY to be removed. |
| void CGame::object_remove | ( | long | id | ) |
Remove an entity from the current level.
| id | Game Entity ID of object we want removed. |
| int CGame::object_add_cmp | ( | ENTITY * | pEnt, | |
| int | type | |||
| ) |
Add a component to the entity.
| pEnt | Pointer to the entity we are adding a new component to. | |
| type | The component we are adding (see t7EnityCMP_ list). |
Set an entity's property.
| pEnt | Pointer to ENTITY to be edited. | |
| cmp | CMP enum of CMP to be set. | |
| data | The data used to preform the action (see EDIT_DATA struct). |
| int CGame::object_set | ( | ENTITY * | pEnt, | |
| const EDIT_DATA & | editData | |||
| ) |
Set an entity's property.
| pEnt | Pointer to ENTITY to be edited. | |
| editData | The data used to set (see EDIT_DATA struct). |
| int CGame::object_get | ( | ENTITY * | pEnt, | |
| EDIT_DATA & | editData | |||
| ) |
Get a value from an entity.
| pEnt | Pointer to ENTITY who's data we are looking at. | |
| editData | This will be filled with the requested data (see EDIT_DATA struct). |
Get a value from an entity.
| pEnt | Pointer to ENTITY who's data we are looking at. | |
| cmpType | The component we are checking. | |
| editData | This will be filled with the requested data (see EDIT_DATA struct). |
| int CGame::object_get | ( | const long | id, | |
| EDIT_DATA & | editData | |||
| ) |
Get a value from an entity.
| id | ID number of entity who's data we are looking at. | |
| editData | This will be filled with the requested data (see EDIT_DATA struct). |
| int CGame::object_act | ( | ENTITY * | pEnt, | |
| const ACTION_DATA & | actData | |||
| ) |
Act on an entity (do damage, activate, etc.).
| pEnt | Pointer to ENTITY to be edited. | |
| actData | The data used to preform the action (see ACTION_DATA). |
| int CGame::object_act | ( | ENTITY * | pEnt, | |
| eCmp | cmpType, | |||
| const ACTION_DATA & | data | |||
| ) |
Act on an entity (do damage, activate, etc.).
| pEnt | Pointer to ENTITY to be acted on. | |
| cmpType | The component we are looking for. | |
| data | The data used to preform the action (see ACTION_DATA). |
| bool CGame::event_set_data | ( | const T7EVENT_DATA & | data | ) |
\ name Event methods
Store data for event driven message passing
| data | Data values for an event (see T7EVENT_DATA) |
| bool CGame::event_get_data | ( | T7EVENT_DATA & | data | ) |
Get event data.
| data | Data values for an event (see T7EVENT_DATA) |
we've expired
| bool CGame::event_get_data | ( | T7EVENT_DATA & | data, | |
| const int | event_type | |||
| ) |
Get event data.
| data | Data values for an event (see T7EVENT_DATA) | |
| event_type | The type of event we are looking for (EVENT_SCAN, EVENT_SHOOT, etc) |
| bool CGame::camera_add | ( | CCameraBase * | cam | ) | [inline] |
Add a global camera.
| cam | A pointer to a camera object. |
| bool CGame::camera_add | ( | int | type | ) | [inline] |
Add a global camera.
| type | Type of camera to be added. |
| bool CGame::camera_set_target | ( | ENTITY * | ent, | |
| float | x, | |||
| float | y, | |||
| float | z | |||
| ) | [inline] |
Change the target entity for the cameras.
| ent | A pointer to an ENTITY | |
| x | The X offset | |
| y | The Y offset | |
| z | The Z offset |
| int CGame::entityData_count | ( | ) | [inline] |
Return the number of base behavior in this game instance.
| bool CGame::entityData_load | ( | const char * | filename, | |
| const char * | path = NULL | |||
| ) |
Load in the behavior description from a file.
| filename | Name of the file containing behavior description | |
| path | Path to the given file (NULL if path is included in filename) |
| bool CGame::entityData_valid | ( | const char * | str | ) |
Is the data named valid?
| str | Name of the entityData we are checking for |
| bool CGame::ui_add | ( | CUi * | pUi | ) | [inline] |
Add a UI object to this level.
| pUi | Pointer to a UI object |
| bool CGame::ui_add | ( | eUI | type | ) | [inline] |
Create and add a UI object to this level.
| type | Type of UI to create |
1.5.4