From bca8b75a8133a12dd52c877b3c33e2f15a2f3697 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sat, 11 Oct 2014 20:23:13 +0200 Subject: [PATCH] Allow input systems to be disabled To avoid trouble when running multiple instances on one machine, disable e.g. joystick input for second instance by --prop:bool:/sim/input/no-joystick-input=true Also allowed: --prop:bool:/sim/input/no-event-input=true --prop:bool:/sim/input/no-mouse-input=true --prop:bool:/sim/input/no-keyboard-input=true --- src/Input/input.cxx | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 3804e8e94..55ea02d99 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -30,6 +30,7 @@ #include +#include
#include "FGMouseInput.hxx" #include "FGKeyboardInput.hxx" #include "FGJoystickInput.hxx" @@ -56,11 +57,29 @@ FGInput::FGInput () { - set_subsystem( "input-mouse", new FGMouseInput() ); - set_subsystem( "input-keyboard", new FGKeyboardInput() ); - set_subsystem( "input-joystick", new FGJoystickInput() ); + if( fgGetBool("/sim/input/no-mouse-input",false) ) { + SG_LOG(SG_INPUT,SG_ALERT,"Mouse input disabled!"); + } else { + set_subsystem( "input-mouse", new FGMouseInput() ); + } + + if( fgGetBool("/sim/input/no-keyboard-input",false) ) { + SG_LOG(SG_INPUT,SG_ALERT,"Keyboard input disabled!"); + } else { + set_subsystem( "input-keyboard", new FGKeyboardInput() ); + } + + if( fgGetBool("/sim/input/no-joystick-input",false) ) { + SG_LOG(SG_INPUT,SG_ALERT,"Joystick input disabled!"); + } else { + set_subsystem( "input-joystick", new FGJoystickInput() ); + } #ifdef INPUTEVENT_CLASS - set_subsystem( "input-event", new INPUTEVENT_CLASS() ); + if( fgGetBool("/sim/input/no-event-input",false) ) { + SG_LOG(SG_INPUT,SG_ALERT,"Event input disabled!"); + } else { + set_subsystem( "input-event", new INPUTEVENT_CLASS() ); + } #endif } -- 2.39.5