mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Inital value for joysticks is 0.5
This commit is contained in:
parent
073a2f0674
commit
ad54e09593
@ -1120,11 +1120,13 @@ namespace MWInput
|
|||||||
if (defaultKeyBindings.find(i) != defaultKeyBindings.end()
|
if (defaultKeyBindings.find(i) != defaultKeyBindings.end()
|
||||||
&& !mInputBinder->isKeyBound(defaultKeyBindings[i]))
|
&& !mInputBinder->isKeyBound(defaultKeyBindings[i]))
|
||||||
{
|
{
|
||||||
|
control->setInitialValue(0.0f);
|
||||||
mInputBinder->addKeyBinding(control, defaultKeyBindings[i], ICS::Control::INCREASE);
|
mInputBinder->addKeyBinding(control, defaultKeyBindings[i], ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
else if (defaultMouseButtonBindings.find(i) != defaultMouseButtonBindings.end()
|
else if (defaultMouseButtonBindings.find(i) != defaultMouseButtonBindings.end()
|
||||||
&& !mInputBinder->isMouseButtonBound(defaultMouseButtonBindings[i]))
|
&& !mInputBinder->isMouseButtonBound(defaultMouseButtonBindings[i]))
|
||||||
{
|
{
|
||||||
|
control->setInitialValue(0.0f);
|
||||||
mInputBinder->addMouseButtonBinding (control, defaultMouseButtonBindings[i], ICS::Control::INCREASE);
|
mInputBinder->addMouseButtonBinding (control, defaultMouseButtonBindings[i], ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1167,7 +1169,11 @@ namespace MWInput
|
|||||||
bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0;
|
bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0;
|
||||||
if (!controlExists)
|
if (!controlExists)
|
||||||
{
|
{
|
||||||
control = new ICS::Control(boost::lexical_cast<std::string>(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX);
|
int inital;
|
||||||
|
if (defaultButtonBindings.find(i) != defaultButtonBindings.end())
|
||||||
|
inital = 0.0f;
|
||||||
|
else inital = 0.5f;
|
||||||
|
control = new ICS::Control(boost::lexical_cast<std::string>(i), false, true, inital, ICS::ICS_MAX, ICS::ICS_MAX);
|
||||||
mInputBinder->addControl(control);
|
mInputBinder->addControl(control);
|
||||||
control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT);
|
control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT);
|
||||||
}
|
}
|
||||||
@ -1182,11 +1188,13 @@ namespace MWInput
|
|||||||
|
|
||||||
if (defaultButtonBindings.find(i) != defaultButtonBindings.end())
|
if (defaultButtonBindings.find(i) != defaultButtonBindings.end())
|
||||||
{
|
{
|
||||||
control->setValue(0.5f);
|
control->setInitialValue(0.0f);
|
||||||
mInputBinder->addJoystickButtonBinding(control, defaultButtonBindings[i], ICS::Control::INCREASE);
|
mInputBinder->addJoystickButtonBinding(control, defaultButtonBindings[i], ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
else if (defaultAxisBindings.find(i) != defaultAxisBindings.end())
|
else if (defaultAxisBindings.find(i) != defaultAxisBindings.end())
|
||||||
{
|
{
|
||||||
|
control->setValue(0.5f);
|
||||||
|
control->setInitialValue(0.5f);
|
||||||
mInputBinder->addJoystickAxisBinding(control, defaultAxisBindings[i], ICS::Control::INCREASE);
|
mInputBinder->addJoystickAxisBinding(control, defaultAxisBindings[i], ICS::Control::INCREASE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1426,6 +1434,7 @@ namespace MWInput
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
clearAllKeyBindings(control);
|
clearAllKeyBindings(control);
|
||||||
|
control->setInitialValue(0.0f);
|
||||||
ICS::DetectingBindingListener::keyBindingDetected (ICS, control, key, direction);
|
ICS::DetectingBindingListener::keyBindingDetected (ICS, control, key, direction);
|
||||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||||
}
|
}
|
||||||
@ -1436,6 +1445,7 @@ namespace MWInput
|
|||||||
if(!mDetectingKeyboard)
|
if(!mDetectingKeyboard)
|
||||||
return;
|
return;
|
||||||
clearAllKeyBindings(control);
|
clearAllKeyBindings(control);
|
||||||
|
control->setInitialValue(0.0f);
|
||||||
ICS::DetectingBindingListener::mouseButtonBindingDetected (ICS, control, button, direction);
|
ICS::DetectingBindingListener::mouseButtonBindingDetected (ICS, control, button, direction);
|
||||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||||
}
|
}
|
||||||
@ -1451,6 +1461,7 @@ namespace MWInput
|
|||||||
|
|
||||||
clearAllControllerBindings(control);
|
clearAllControllerBindings(control);
|
||||||
control->setValue(0.5f); //axis bindings must start at 0.5
|
control->setValue(0.5f); //axis bindings must start at 0.5
|
||||||
|
control->setInitialValue(0.5f);
|
||||||
ICS::DetectingBindingListener::joystickAxisBindingDetected (ICS, control, axis, direction);
|
ICS::DetectingBindingListener::joystickAxisBindingDetected (ICS, control, axis, direction);
|
||||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||||
}
|
}
|
||||||
@ -1461,6 +1472,7 @@ namespace MWInput
|
|||||||
if(mDetectingKeyboard)
|
if(mDetectingKeyboard)
|
||||||
return;
|
return;
|
||||||
clearAllControllerBindings(control);
|
clearAllControllerBindings(control);
|
||||||
|
control->setInitialValue(0.0f);
|
||||||
ICS::DetectingBindingListener::joystickButtonBindingDetected (ICS, control, button, direction);
|
ICS::DetectingBindingListener::joystickButtonBindingDetected (ICS, control, button, direction);
|
||||||
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
MWBase::Environment::get().getWindowManager ()->notifyInputActionBound ();
|
||||||
}
|
}
|
||||||
|
7
extern/oics/ICSControl.h
vendored
7
extern/oics/ICSControl.h
vendored
@ -34,7 +34,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
namespace ICS
|
namespace ICS
|
||||||
{
|
{
|
||||||
|
|
||||||
class DllExport Control
|
class DllExport Control
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -52,9 +52,10 @@ namespace ICS
|
|||||||
|
|
||||||
void setValue(float value);
|
void setValue(float value);
|
||||||
inline float getValue(){ return mValue; };
|
inline float getValue(){ return mValue; };
|
||||||
inline float getInitialValue(){ return mInitialValue; };
|
inline float getInitialValue(){ return mInitialValue; };
|
||||||
|
inline void setInitialValue(float i) {mInitialValue = i;};
|
||||||
|
|
||||||
void attachChannel(Channel* channel, Channel::ChannelDirection direction, float percentage = 1.0);
|
void attachChannel(Channel* channel, Channel::ChannelDirection direction, float percentage = 1.0);
|
||||||
std::list<Channel*> getAttachedChannels(){ return mAttachedChannels; };
|
std::list<Channel*> getAttachedChannels(){ return mAttachedChannels; };
|
||||||
|
|
||||||
inline float getStepSize(){ return mStepSize; };
|
inline float getStepSize(){ return mStepSize; };
|
||||||
|
2
extern/oics/ICSInputControlSystem.cpp
vendored
2
extern/oics/ICSInputControlSystem.cpp
vendored
@ -278,6 +278,7 @@ namespace ICS
|
|||||||
/* Joystick Init */
|
/* Joystick Init */
|
||||||
|
|
||||||
//Load controller mappings
|
//Load controller mappings
|
||||||
|
#if SDL_VERSION_ATLEAST(2,0,2)
|
||||||
int res = SDL_GameControllerAddMappingsFromFile("resources/gamecontrollerdb.txt");
|
int res = SDL_GameControllerAddMappingsFromFile("resources/gamecontrollerdb.txt");
|
||||||
if(res == -1)
|
if(res == -1)
|
||||||
{
|
{
|
||||||
@ -287,6 +288,7 @@ namespace ICS
|
|||||||
{
|
{
|
||||||
ICS_LOG(std::string("Loaded ")+boost::lexical_cast<std::string>(res)+" Game controller bindings");
|
ICS_LOG(std::string("Loaded ")+boost::lexical_cast<std::string>(res)+" Game controller bindings");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Open all presently connected sticks
|
//Open all presently connected sticks
|
||||||
int numSticks = SDL_NumJoysticks();
|
int numSticks = SDL_NumJoysticks();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user