2021-03-01 12:52:24 -08:00
|
|
|
/* Copyright (C) 2021 Wildfire Games.
|
2010-01-09 11:20:14 -08:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
2019-09-22 16:28:25 -07:00
|
|
|
#include "ScriptFunctions.h"
|
2010-01-09 11:20:14 -08:00
|
|
|
|
2014-11-12 17:26:22 -08:00
|
|
|
#include "graphics/scripting/JSInterface_GameView.h"
|
2019-10-02 02:44:00 -07:00
|
|
|
#include "gui/Scripting/JSInterface_GUIManager.h"
|
|
|
|
|
#include "gui/Scripting/JSInterface_GUISize.h"
|
2014-04-20 13:03:57 -07:00
|
|
|
#include "i18n/scripting/JSInterface_L10n.h"
|
2013-11-16 10:38:40 -08:00
|
|
|
#include "lobby/scripting/JSInterface_Lobby.h"
|
2017-09-11 17:29:10 -07:00
|
|
|
#include "network/scripting/JSInterface_Network.h"
|
2013-09-29 11:56:50 -07:00
|
|
|
#include "ps/scripting/JSInterface_ConfigDB.h"
|
2013-09-21 07:48:19 -07:00
|
|
|
#include "ps/scripting/JSInterface_Console.h"
|
2017-09-11 19:25:28 -07:00
|
|
|
#include "ps/scripting/JSInterface_Debug.h"
|
2017-09-11 18:38:46 -07:00
|
|
|
#include "ps/scripting/JSInterface_Game.h"
|
Let players remap hotkeys in-game, fix default hotkeys being qwerty-specific.
- Provide a "Hotkey" screen to let players remap hotkeys in-game using a
convenient setup.
- Make all .cfg hotkeys refer to scancodes (i.e. position on the
keyboard), so that default hotkeys now translate correctly for AZERTY,
QWERTZ and other layouts.
- 'BackSpace' is now an alias for 'Delete', and works for killing units.
This fixes #1917, as macs don't have a proper delete key and would need
to use Fn+Del otherwise. This shifts "timewarp" to Shift+BackSpace.
Functionally, this switches hotkeys to scancodes, as that makes more
sense (they are combinations of key positions, not actual text output).
SDL includes are cleaned and key names are reused.
Fixes #2850, Fixes #2604, Refs #1810, Fixes #1917.
Follows work in 3d7784d2af.
Various diffs tested by: Angen, Stan, Freagarach
Comments by: Nescio
Differential Revision: https://code.wildfiregames.com/D2814
This was SVN commit r24215.
2020-11-19 01:27:26 -08:00
|
|
|
#include "ps/scripting/JSInterface_Hotkey.h"
|
2017-09-11 20:11:33 -07:00
|
|
|
#include "ps/scripting/JSInterface_Main.h"
|
2014-08-25 09:02:54 -07:00
|
|
|
#include "ps/scripting/JSInterface_Mod.h"
|
2018-04-24 06:12:08 -07:00
|
|
|
#include "ps/scripting/JSInterface_ModIo.h"
|
2017-09-11 16:22:28 -07:00
|
|
|
#include "ps/scripting/JSInterface_SavedGame.h"
|
2018-08-22 05:48:27 -07:00
|
|
|
#include "ps/scripting/JSInterface_UserReport.h"
|
2014-01-04 02:14:53 -08:00
|
|
|
#include "ps/scripting/JSInterface_VFS.h"
|
2015-09-21 10:00:21 -07:00
|
|
|
#include "ps/scripting/JSInterface_VisualReplay.h"
|
2013-09-21 01:24:45 -07:00
|
|
|
#include "renderer/scripting/JSInterface_Renderer.h"
|
2019-09-22 16:28:25 -07:00
|
|
|
#include "scriptinterface/ScriptInterface.h"
|
2017-09-11 18:53:46 -07:00
|
|
|
#include "simulation2/scripting/JSInterface_Simulation.h"
|
2014-01-04 02:14:53 -08:00
|
|
|
#include "soundmanager/scripting/JSInterface_Sound.h"
|
2010-01-09 11:20:14 -08:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This file defines a set of functions that are available to GUI scripts, to allow
|
|
|
|
|
* interaction with the rest of the engine.
|
|
|
|
|
* Functions are exposed to scripts within the global object 'Engine', so
|
|
|
|
|
* scripts should call "Engine.FunctionName(...)" etc.
|
|
|
|
|
*/
|
|
|
|
|
void GuiScriptingInit(ScriptInterface& scriptInterface)
|
|
|
|
|
{
|
2021-03-01 12:52:24 -08:00
|
|
|
ScriptRequest rq(scriptInterface);
|
|
|
|
|
|
2019-09-30 01:19:56 -07:00
|
|
|
JSI_GUISize::RegisterScriptClass(scriptInterface);
|
2013-09-29 11:56:50 -07:00
|
|
|
JSI_ConfigDB::RegisterScriptFunctions(scriptInterface);
|
2021-03-01 12:52:24 -08:00
|
|
|
JSI_Console::RegisterScriptFunctions(rq);
|
2017-09-11 19:25:28 -07:00
|
|
|
JSI_Debug::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 17:54:49 -07:00
|
|
|
JSI_GUIManager::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 20:11:33 -07:00
|
|
|
JSI_Game::RegisterScriptFunctions(scriptInterface);
|
|
|
|
|
JSI_GameView::RegisterScriptFunctions(scriptInterface);
|
Let players remap hotkeys in-game, fix default hotkeys being qwerty-specific.
- Provide a "Hotkey" screen to let players remap hotkeys in-game using a
convenient setup.
- Make all .cfg hotkeys refer to scancodes (i.e. position on the
keyboard), so that default hotkeys now translate correctly for AZERTY,
QWERTZ and other layouts.
- 'BackSpace' is now an alias for 'Delete', and works for killing units.
This fixes #1917, as macs don't have a proper delete key and would need
to use Fn+Del otherwise. This shifts "timewarp" to Shift+BackSpace.
Functionally, this switches hotkeys to scancodes, as that makes more
sense (they are combinations of key positions, not actual text output).
SDL includes are cleaned and key names are reused.
Fixes #2850, Fixes #2604, Refs #1810, Fixes #1917.
Follows work in 3d7784d2af.
Various diffs tested by: Angen, Stan, Freagarach
Comments by: Nescio
Differential Revision: https://code.wildfiregames.com/D2814
This was SVN commit r24215.
2020-11-19 01:27:26 -08:00
|
|
|
JSI_Hotkey::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 20:11:33 -07:00
|
|
|
JSI_L10n::RegisterScriptFunctions(scriptInterface);
|
|
|
|
|
JSI_Lobby::RegisterScriptFunctions(scriptInterface);
|
|
|
|
|
JSI_Main::RegisterScriptFunctions(scriptInterface);
|
2014-08-25 09:02:54 -07:00
|
|
|
JSI_Mod::RegisterScriptFunctions(scriptInterface);
|
2018-04-24 06:12:08 -07:00
|
|
|
JSI_ModIo::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 17:29:10 -07:00
|
|
|
JSI_Network::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 20:11:33 -07:00
|
|
|
JSI_Renderer::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 16:22:28 -07:00
|
|
|
JSI_SavedGame::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 18:53:46 -07:00
|
|
|
JSI_Simulation::RegisterScriptFunctions(scriptInterface);
|
2017-09-11 20:11:33 -07:00
|
|
|
JSI_Sound::RegisterScriptFunctions(scriptInterface);
|
2018-08-22 05:48:27 -07:00
|
|
|
JSI_UserReport::RegisterScriptFunctions(scriptInterface);
|
2017-12-03 15:02:27 -08:00
|
|
|
JSI_VFS::RegisterScriptFunctions_GUI(scriptInterface);
|
2015-09-21 10:00:21 -07:00
|
|
|
JSI_VisualReplay::RegisterScriptFunctions(scriptInterface);
|
2010-01-09 11:20:14 -08:00
|
|
|
}
|