Line data Source code
1 : /* Copyright (C) 2026 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_CGUISize.h" 24 : #include "gui/Scripting/JSInterface_GUIManager.h" 25 : #include "gui/Scripting/JSInterface_GUISize.h" 26 : #include "i18n/scripting/JSInterface_L10n.h" 27 : #include "lobby/scripting/JSInterface_Lobby.h" 28 : #include "network/scripting/JSInterface_Network.h" 29 : #include "ps/scripting/JSInterface_ConfigDB.h" 30 : #include "ps/scripting/JSInterface_Console.h" 31 : #include "ps/scripting/JSInterface_Debug.h" 32 : #include "ps/scripting/JSInterface_Game.h" 33 : #include "ps/scripting/JSInterface_Hotkey.h" 34 : #include "ps/scripting/JSInterface_Main.h" 35 : #include "ps/scripting/JSInterface_Mod.h" 36 : #include "ps/scripting/JSInterface_ModIo.h" 37 : #include "ps/scripting/JSInterface_SavedGame.h" 38 : #include "ps/scripting/JSInterface_UserReport.h" 39 : #include "ps/scripting/JSInterface_VFS.h" 40 : #include "ps/scripting/JSInterface_VisualReplay.h" 41 : #include "renderer/scripting/JSInterface_Renderer.h" 42 : #include "scriptinterface/Request.h" 43 : #include "simulation2/scripting/JSInterface_Simulation.h" 44 : #include "soundmanager/scripting/JSInterface_Sound.h" 45 : 46 : /* 47 : * This file defines a set of functions that are available to GUI scripts, to allow 48 : * interaction with the rest of the engine. 49 : * Functions are exposed to scripts within the global object 'Engine', so 50 : * scripts should call "Engine.FunctionName(...)" etc. 51 : */ 52 26 : void GuiScriptingInit(Script::Interface& scriptInterface) 53 : { 54 26 : Script::Request rq(scriptInterface); 55 : 56 26 : JSI_GUISize::RegisterScriptClass(scriptInterface); 57 26 : JSI_CGUISize::RegisterScriptClass(scriptInterface); 58 26 : JSI_ConfigDB::RegisterScriptFunctions(rq); 59 26 : JSI_Console::RegisterScriptFunctions(rq); 60 26 : JSI_Debug::RegisterScriptFunctions(rq); 61 26 : JSI_GUIManager::RegisterScriptFunctions(rq); 62 26 : JSI_Game::RegisterScriptFunctions(rq); 63 26 : JSI_GameView::RegisterScriptFunctions(rq); 64 26 : JSI_Hotkey::RegisterScriptFunctions(rq); 65 26 : JSI_L10n::RegisterScriptFunctions(rq); 66 26 : JSI_Lobby::RegisterScriptFunctions(rq); 67 26 : JSI_Main::RegisterScriptFunctions(rq); 68 26 : JSI_Mod::RegisterScriptFunctions(rq); 69 26 : JSI_ModIo::RegisterScriptFunctions(rq); 70 26 : JSI_Network::RegisterScriptFunctions(rq); 71 26 : JSI_Renderer::RegisterScriptFunctions(rq); 72 26 : JSI_SavedGame::RegisterScriptFunctions(rq); 73 26 : JSI_Simulation::RegisterScriptFunctions(rq); 74 26 : JSI_Sound::RegisterScriptFunctions(rq); 75 26 : JSI_UserReport::RegisterScriptFunctions(rq); 76 26 : JSI_VFS::RegisterScriptFunctions_ReadWriteAnywhere(rq); 77 26 : JSI_VisualReplay::RegisterScriptFunctions(rq); 78 26 : }