X-Git-Url: https://git.yukkurigames.com/?a=blobdiff_plain;f=JSActionAnalog.m;h=e35199613cabfd2fe2e8d43319ad71b41137a0e8;hb=38634b871c4f90b179bc5cba1cae9b748a0fa078;hp=a1c57e8533c2668737b265a9cc1902471ed939e5;hpb=530009447c5bbd360ac5023979cffc6d32a28df3;p=enjoyable.git 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;