Use define instead of hardcoded number.

This commit is contained in:
Steve 2018-02-21 08:13:19 +00:00
parent 2fabf5302b
commit a351849f5c
2 changed files with 6 additions and 4 deletions

View File

@ -27,22 +27,22 @@ int isControl(int type)
key = app.config.keyControls[type]; key = app.config.keyControls[type];
btn = app.config.joypadControls[type]; btn = app.config.joypadControls[type];
if (type == CONTROL_LEFT && app.joypadAxis[JOYPAD_AXIS_X] <= -16384) if (type == CONTROL_LEFT && app.joypadAxis[JOYPAD_AXIS_X] <= -AXIS_MAX / 2)
{ {
return 1; return 1;
} }
if (type == CONTROL_RIGHT && app.joypadAxis[JOYPAD_AXIS_X] >= 16384) if (type == CONTROL_RIGHT && app.joypadAxis[JOYPAD_AXIS_X] >= AXIS_MAX / 2)
{ {
return 1; return 1;
} }
if (type == CONTROL_UP && app.joypadAxis[JOYPAD_AXIS_Y] <= -16384) if (type == CONTROL_UP && app.joypadAxis[JOYPAD_AXIS_Y] <= -AXIS_MAX / 2)
{ {
return 1; return 1;
} }
if (type == CONTROL_DOWN && app.joypadAxis[JOYPAD_AXIS_Y] >= 16384) if (type == CONTROL_DOWN && app.joypadAxis[JOYPAD_AXIS_Y] >= AXIS_MAX / 2)
{ {
return 1; return 1;
} }

View File

@ -20,4 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../common.h" #include "../common.h"
#define AXIS_MAX 32767
extern App app; extern App app;