MCPcopy Create free account
hub / github.com/360Controller/360Controller / normalizeAxis

Method normalizeAxis

360Controller/_60Controller.cpp:721–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

719}
720
721void Xbox360Peripheral::normalizeAxis(SInt16& axis, short deadzone)
722{
723 static const UInt16 max16=32767;
724 const float current=getAbsolute(axis);
725 const float maxVal=max16-deadzone;
726
727 if (current>deadzone) {
728 if (axis<0) {
729 axis=max16*(current-deadzone)/maxVal;
730 axis=~axis;
731 } else {
732 axis=max16*(current-deadzone)/maxVal;
733 }
734 } else {
735 axis=0;
736 }
737}
738
739void Xbox360Peripheral::fiddleReport(XBOX360_HAT& left, XBOX360_HAT& right)
740{

Callers

nothing calls this directly

Calls 1

getAbsoluteFunction · 0.70

Tested by

no test coverage detected