mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Allow JS GUI pages to find out if the game is running.
Differential Revision: https://code.wildfiregames.com/D2289 Tested on: clang 8.0.1. This was SVN commit r22900.
This commit is contained in:
parent
cab920696c
commit
89e511def9
2 changed files with 7 additions and 0 deletions
|
|
@ -33,6 +33,11 @@
|
|||
|
||||
extern void EndGame();
|
||||
|
||||
bool JSI_Game::IsGameStarted(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
return g_Game;
|
||||
}
|
||||
|
||||
void JSI_Game::StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID)
|
||||
{
|
||||
ENSURE(!g_NetServer);
|
||||
|
|
@ -162,6 +167,7 @@ void JSI_Game::DumpTerrainMipmap(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
|||
|
||||
void JSI_Game::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<bool, &IsGameStarted>("IsGameStarted");
|
||||
scriptInterface.RegisterFunction<void, JS::HandleValue, int, &StartGame>("StartGame");
|
||||
scriptInterface.RegisterFunction<void, &Script_EndGame>("EndGame");
|
||||
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
namespace JSI_Game
|
||||
{
|
||||
bool IsGameStarted(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void StartGame(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue attribs, int playerID);
|
||||
void Script_EndGame(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
int GetPlayerID(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
|
|
|
|||
Loading…
Reference in a new issue