Line data Source code
1 : /* Copyright (C) 2022 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #include "precompiled.h"
19 :
20 : #include "ScriptFunctions.h"
21 :
22 : #include "graphics/scripting/JSInterface_GameView.h"
23 : #include "gui/Scripting/JSInterface_GUIManager.h"
24 : #include "gui/Scripting/JSInterface_GUISize.h"
25 : #include "i18n/scripting/JSInterface_L10n.h"
26 : #include "lobby/scripting/JSInterface_Lobby.h"
27 : #include "network/scripting/JSInterface_Network.h"
28 : #include "ps/scripting/JSInterface_ConfigDB.h"
29 : #include "ps/scripting/JSInterface_Console.h"
30 : #include "ps/scripting/JSInterface_Debug.h"
31 : #include "ps/scripting/JSInterface_Game.h"
32 : #include "ps/scripting/JSInterface_Hotkey.h"
33 : #include "ps/scripting/JSInterface_Main.h"
34 : #include "ps/scripting/JSInterface_Mod.h"
35 : #include "ps/scripting/JSInterface_ModIo.h"
36 : #include "ps/scripting/JSInterface_SavedGame.h"
37 : #include "ps/scripting/JSInterface_UserReport.h"
38 : #include "ps/scripting/JSInterface_VFS.h"
39 : #include "ps/scripting/JSInterface_VisualReplay.h"
40 : #include "renderer/scripting/JSInterface_Renderer.h"
41 : #include "scriptinterface/ScriptInterface.h"
42 : #include "simulation2/scripting/JSInterface_Simulation.h"
43 : #include "soundmanager/scripting/JSInterface_Sound.h"
44 :
45 : /*
46 : * This file defines a set of functions that are available to GUI scripts, to allow
47 : * interaction with the rest of the engine.
48 : * Functions are exposed to scripts within the global object 'Engine', so
49 : * scripts should call "Engine.FunctionName(...)" etc.
50 : */
51 12 : void GuiScriptingInit(ScriptInterface& scriptInterface)
52 : {
53 24 : ScriptRequest rq(scriptInterface);
54 :
55 12 : JSI_GUISize::RegisterScriptClass(scriptInterface);
56 12 : JSI_ConfigDB::RegisterScriptFunctions(rq);
57 12 : JSI_Console::RegisterScriptFunctions(rq);
58 12 : JSI_Debug::RegisterScriptFunctions(rq);
59 12 : JSI_GUIManager::RegisterScriptFunctions(rq);
60 12 : JSI_Game::RegisterScriptFunctions(rq);
61 12 : JSI_GameView::RegisterScriptFunctions(rq);
62 12 : JSI_Hotkey::RegisterScriptFunctions(rq);
63 12 : JSI_L10n::RegisterScriptFunctions(rq);
64 12 : JSI_Lobby::RegisterScriptFunctions(rq);
65 12 : JSI_Main::RegisterScriptFunctions(rq);
66 12 : JSI_Mod::RegisterScriptFunctions(rq);
67 12 : JSI_ModIo::RegisterScriptFunctions(rq);
68 12 : JSI_Network::RegisterScriptFunctions(rq);
69 12 : JSI_Renderer::RegisterScriptFunctions(rq);
70 12 : JSI_SavedGame::RegisterScriptFunctions(rq);
71 12 : JSI_Simulation::RegisterScriptFunctions(rq);
72 12 : JSI_Sound::RegisterScriptFunctions(rq);
73 12 : JSI_UserReport::RegisterScriptFunctions(rq);
74 12 : JSI_VFS::RegisterScriptFunctions_ReadWriteAnywhere(rq);
75 12 : JSI_VisualReplay::RegisterScriptFunctions(rq);
76 12 : }
|