Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
InputEngineAngelscriptGeneric.cpp
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2022 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
25
26#include "../../autowrapper/aswrappedcall.h"
27#include "AngelScriptBindings.h"
28#include "InputEngine.h"
29#include "ScriptEngine.h"
30
31#include <OIS.h>
32
33using namespace AngelScript;
34using namespace RoR;
35using namespace OIS;
36
37void RoR::RegisterInputEngineGeneric(asIScriptEngine* engine)
38{
39 // Please maintain the same order as in 'InputEngine.cpp' and 'docs/*/InputEngineClass.h'
40 // --------------------------------------------------------------------------------------
41
42 int result = 0;
43 // NOTE: object type InputEngineClass and all enums are registered in RegisterInputEngineCommon()
44
45 // > Input processing
46 result = engine->RegisterObjectMethod("InputEngineClass", "void setEventSimulatedValue(inputEvents ev, float value)", WRAP_MFN(InputEngine, setEventSimulatedValue), asCALL_GENERIC); ROR_ASSERT(result>=0);
47 result = engine->RegisterObjectMethod("InputEngineClass", "void setEventStatusSupressed(inputEvents ev, bool supressed)", WRAP_MFN(InputEngine, setEventStatusSupressed), asCALL_GENERIC); ROR_ASSERT(result>=0);
48
49 // > Event info
50 result = engine->RegisterObjectMethod("InputEngineClass", "string getEventCommand(inputEvents ev)", WRAP_MFN(InputEngine, getEventCommand), asCALL_GENERIC); ROR_ASSERT(result>=0);
51 result = engine->RegisterObjectMethod("InputEngineClass", "string getEventCommandTrimmed(inputEvents ev)", WRAP_MFN(InputEngine, getEventCommandTrimmed), asCALL_GENERIC); ROR_ASSERT(result>=0);
52
53 // > Event states
54 result = engine->RegisterObjectMethod("InputEngineClass", "float getEventValue(inputEvents, bool = false, inputSourceType = inputSourceType::IST_ANY)", WRAP_MFN(InputEngine, getEventValue), asCALL_GENERIC); ROR_ASSERT(result>=0);
55 result = engine->RegisterObjectMethod("InputEngineClass", "bool getEventBoolValue(inputEvents ev)", WRAP_MFN(InputEngine, getEventBoolValue), asCALL_GENERIC); ROR_ASSERT(result >= 0);
56 result = engine->RegisterObjectMethod("InputEngineClass", "bool getEventBoolValueBounce(inputEvents ev, float time = 0.2f)", WRAP_MFN(InputEngine, getEventBoolValueBounce), asCALL_GENERIC); ROR_ASSERT(result>=0);
57 result = engine->RegisterObjectMethod("InputEngineClass", "bool isKeyDownEffective(keyCodes keycode)", WRAP_MFN(InputEngine, isKeyDownEffective), asCALL_GENERIC); ROR_ASSERT(result>=0);
58 result = engine->RegisterObjectMethod("InputEngineClass", "bool isKeyDownValueBounce(keyCodes keycode, float time = 0.2f)", WRAP_MFN(InputEngine, isKeyDownValueBounce), asCALL_GENERIC); ROR_ASSERT(result>=0);
59
60 // Direct input device states
61 result = engine->RegisterObjectMethod("InputEngineClass", "bool isKeyDown(keyCodes keycode)", WRAP_MFN(InputEngine, isKeyDown), asCALL_GENERIC); ROR_ASSERT(result>=0);
62}
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
Handles controller inputs from player.
#define WRAP_MFN(ClassType, name)
Manages controller configuration, evaluates input events.
void RegisterInputEngineGeneric(AngelScript::asIScriptEngine *engine)