Skip to content

Commit

Permalink
fix input binding.cpp?
Browse files Browse the repository at this point in the history
  • Loading branch information
melody-rs committed Aug 15, 2024
1 parent e7556ce commit 29568d1
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions binding/input-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,18 +369,19 @@ RB_METHOD(inputControllerPowerLevel) {
if (!shState->input().getControllerConnected())
ret = M_SYMBOL("UNKNOWN");

switch (shState->input().getControllerPowerLevel()) {
POWERCASE(ret, MAX);
POWERCASE(ret, WIRED);
POWERCASE(ret, FULL);
POWERCASE(ret, MEDIUM);
POWERCASE(ret, LOW);
POWERCASE(ret, EMPTY);
// FIXME: NEED TO IMPLEMENT THIS!
// switch (shState->input().getControllerPowerLevel()) {
// POWERCASE(ret, MAX);
// POWERCASE(ret, WIRED);
// POWERCASE(ret, FULL);
// POWERCASE(ret, MEDIUM);
// POWERCASE(ret, LOW);
// POWERCASE(ret, EMPTY);

default:
ret = M_SYMBOL("UNKNOWN");
break;
}
// default:
ret = M_SYMBOL("UNKNOWN");
// break;
// }

return ret;
}
Expand All @@ -392,14 +393,14 @@ VALUE ret = rb_ary_new(); \
if (!shState->eThread().getControllerConnected()) {\
rb_ary_push(ret, rb_float_new(0)); rb_ary_push(ret, rb_float_new(0)); \
}\
rb_ary_push(ret, rb_float_new(shState->input().getControllerAxisValue(SDL_CONTROLLER_AXIS_##ax1) / 32767.0)); \
rb_ary_push(ret, rb_float_new(shState->input().getControllerAxisValue(SDL_CONTROLLER_AXIS_##ax2) / 32767.0)); \
rb_ary_push(ret, rb_float_new(shState->input().getControllerAxisValue(SDL_GAMEPAD_AXIS_##ax1) / 32767.0)); \
rb_ary_push(ret, rb_float_new(shState->input().getControllerAxisValue(SDL_GAMEPAD_AXIS_##ax2) / 32767.0)); \
return ret; \
}

AXISFUNC(Left, LEFTX, LEFTY);
AXISFUNC(Right, RIGHTX, RIGHTY);
AXISFUNC(Trigger, TRIGGERLEFT, TRIGGERRIGHT);
AXISFUNC(Trigger, LEFT_TRIGGER, RIGHT_TRIGGER);

#undef POWERCASE
#undef M_SYMBOL
Expand Down

0 comments on commit 29568d1

Please sign in to comment.