1
0
forked from 0ad/0ad

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:
elexis 2019-09-14 15:33:46 +00:00
parent cab920696c
commit 89e511def9
2 changed files with 7 additions and 0 deletions

View File

@ -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");

View File

@ -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);