X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=JSActionAnalog.m;h=e35199613cabfd2fe2e8d43319ad71b41137a0e8;hp=a1c57e8533c2668737b265a9cc1902471ed939e5;hb=61f8cdec21ab083b29c22aa11fda54d6005666ca;hpb=ac4ed3987b6aaefc836294f89ff1f569fad6ac6b diff --git a/JSActionAnalog.m b/JSActionAnalog.m index a1c57e8..e351996 100644 --- a/JSActionAnalog.m +++ b/JSActionAnalog.m @@ -30,7 +30,7 @@ //Target* target = [[base->configsController currentConfig] getTargetForAction: [subActions objectAtIndex: 0]]; int raw = IOHIDValueGetIntegerValue(value); - double parsed = offset + scale * raw; + double parsed = [self getRealValue: raw]; if(parsed < -0.3) // fixed?! return [subActions objectAtIndex: 0]; @@ -44,12 +44,17 @@ [[subActions objectAtIndex: 2] setActive: true]; int raw = IOHIDValueGetIntegerValue(value); - double parsed = offset + scale * raw; + double parsed = [self getRealValue: raw]; [[subActions objectAtIndex: 0] setActive: (parsed < -0.3)]; [[subActions objectAtIndex: 1] setActive: (parsed > 0.3)]; } +-(double) getRealValue: (int)value { + double parsed = offset + scale * value; + return parsed; +} + @synthesize offset, scale;