Add in strange gamepad edge case where analog sticks may be falsely spazzing out between 0 and 1. Fix using software checks. Release Build 7967.
This commit is contained in:
parent
6e4f206391
commit
dec1f0516f
@ -410,6 +410,7 @@ void AiL::HandleUserInput(float fElapsedTime){
|
|||||||
|
|
||||||
bool setIdleAnimation=true;
|
bool setIdleAnimation=true;
|
||||||
bool heldDownMovementKey=false; //Is true when a movement key has been held down.
|
bool heldDownMovementKey=false; //Is true when a movement key has been held down.
|
||||||
|
|
||||||
if(KEY_MENU.Released()){
|
if(KEY_MENU.Released()){
|
||||||
Menu::OpenMenu(MenuType::PAUSE);
|
Menu::OpenMenu(MenuType::PAUSE);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 4
|
#define VERSION_MINOR 4
|
||||||
#define VERSION_PATCH 5
|
#define VERSION_PATCH 5
|
||||||
#define VERSION_BUILD 7966
|
#define VERSION_BUILD 7967
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -236,6 +236,7 @@ namespace olc {
|
|||||||
int axisCount = GP_AXIS_COUNT;
|
int axisCount = GP_AXIS_COUNT;
|
||||||
int buttonCount = GP_BUTTON_COUNT;
|
int buttonCount = GP_BUTTON_COUNT;
|
||||||
float axes[GP_AXIS_COUNT]{0};
|
float axes[GP_AXIS_COUNT]{0};
|
||||||
|
float prevAxes[GP_AXIS_COUNT]{0};
|
||||||
olc::HWButton buttons[GP_BUTTON_COUNT];
|
olc::HWButton buttons[GP_BUTTON_COUNT];
|
||||||
bool ff = false;
|
bool ff = false;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
@ -1318,6 +1319,9 @@ olc::GamePad *olc::GamePad::selectWithAnyButton() {
|
|||||||
|
|
||||||
float olc::GamePad::getAxis(olc::GPAxes a) {
|
float olc::GamePad::getAxis(olc::GPAxes a) {
|
||||||
float axis = axes[static_cast<int>(a)];
|
float axis = axes[static_cast<int>(a)];
|
||||||
|
|
||||||
|
if(prevAxes[static_cast<int>(a)]==0.f&&std::abs(prevAxes[static_cast<int>(a)]-axis)>0.9f)return 0.f;
|
||||||
|
|
||||||
if (std::abs(axis) < deadZone) {
|
if (std::abs(axis) < deadZone) {
|
||||||
axis = 0;
|
axis = 0;
|
||||||
}
|
}
|
||||||
@ -1329,6 +1333,9 @@ float olc::GamePad::getAxis(olc::GPAxes a) {
|
|||||||
if (!xInput && (a == GPAxes::TL || a == GPAxes::TR))
|
if (!xInput && (a == GPAxes::TL || a == GPAxes::TR))
|
||||||
return (axis + 1) / 2;
|
return (axis + 1) / 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
prevAxes[static_cast<int>(a)]=axis;
|
||||||
|
|
||||||
return axis;
|
return axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user