File size: 3,480 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
#ifdef GAME_TEMPLATE
Game g_Game;
Game GetGame()
{
return g_Game;
}
class Game
{
ScriptModule GameScript;
ScriptModule GetScriptModule()
{
return GameScript;
}
void SetDebug(bool isDebug) {}
//!
/**
\brief Called when some system event occur.
@param eventTypeId event type.
@param params Param object, cast to specific param class to get parameters for particular event.
*/
void OnEvent(EventType eventTypeId, Param params)
{
Print("OnEvent");
}
/**
\brief Called after full initialization of Game instance
*/
void OnAfterInit()
{
Print("OnAfterInit");
}
/**
\brief Called on World update
@param timeslice time elapsed from last call
*/
void OnUpdate(float timeslice)
{
}
/**
\brief Sets world file to be loaded. Returns false if file doesn't exist.
@param path Path to the ent file
@param reload Force reload the world
*/
proto native bool SetWorldFile(string path, bool reload);
/**
\brief Returns path of world file loaded
*/
proto native owned string GetWorldFile();
/**
\brief Event which is called right before game starts (all entities are created and initialized). Returns true if the game can start.
*/
bool OnGameStart()
{
return true;
}
/**
\brief Event which is called right before game end.
*/
void OnGameEnd()
{
}
/**
\brief Creates loading screen
*/
void ShowLoadingAnim()
{
}
/**
\brief Hides loading screen
*/
void HideLoadingAnim()
{
}
/**
\brief Used for updating the loading screen
@param timeslice
@param progress loading progress between 0 and 1
*/
void UpdateLoadingAnim(float timeslice, float progress)
{
}
/**
\brief Safely instantiate the entity and calls EOnInit if the entity sets event mask EntityEvent.INIT.
@param typename Name of entity's type to instantiate.
@return instantiated entity
*/
proto native IEntity SpawnEntity(typename typeName);
/**
\brief Safely instantiate the entity from template (with all components) and calls EOnInit if the entity sets event mask EntityEvent.INIT.
@param templateResource Template resource of the entity to instantiate.
@return instantiated entity
*/
proto native IEntity SpawnEntityTemplate(vobject templateResource);
/**
\brief Safely instantiate the component from template, insert it to entity and calls EOnInit if the component sets event mask EntityEvent.INIT.
@param owner Entity which will own the component
@param templateResource Template resource of the component to instantiate.
@return instantiated component
*/
proto native GenericComponent SpawnComponentTemplate(IEntity owner, vobject templateResource);
proto native IEntity FindEntity(string name);
proto native WorkspaceWidget GetWorkspace();
/**
\brief Setting request flag for engine to exit the game
*/
proto native void RequestClose();
/**
\brief Setting request flag for the engine to reinitialize the game
* Doesn't do anything in Workbench
*/
proto native void RequestReload();
/**
\brief Returns version of the game
*/
proto native owned string GetBuildVersion();
/**
\brief Returns date and time when the game was built
*/
proto native owned string GetBuildTime();
/**
\brief Returns World entity when in game or in play mode in WE. NULL otherwise.
*/
proto native GenericWorldEntity GetWorldEntity();
proto native InputManager GetInputManager();
proto native MenuManager GetMenuManager();
proto native int GetTickCount();
}
void GameLibInit()
{
}
#endif |