Line data Source code
1 0 : /* 2 : 3 : OOJoystickProfile.h 4 : 5 : JoystickProfile maintains settings such as deadzone and the mapping 6 : from joystick movement to response. 7 : 8 : JoystickSpline manages the mapping of the physical joystick movements 9 : to the joystick response. It holds a series of control points, with 10 : the points (0,0) and (1,1) being assumed. It then interpolates 11 : splines between the set of control points - the segment between (0,0) 12 : and the first control point is linear, the remaining segments 13 : quadratic with the gradients matching at the control point. 14 : 15 : Oolite 16 : Copyright (C) 2004-2013 Giles C Williams and contributors 17 : 18 : This program is free software; you can redistribute it and/or 19 : modify it under the terms of the GNU General Public License 20 : as published by the Free Software Foundation; either version 2 21 : of the License, or (at your option) any later version. 22 : 23 : This program is distributed in the hope that it will be useful, 24 : but WITHOUT ANY WARRANTY; without even the implied warranty of 25 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 : GNU General Public License for more details. 27 : 28 : You should have received a copy of the GNU General Public License 29 : along with this program; if not, write to the Free Software 30 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 31 : MA 02110-1301, USA. 32 : 33 : */ 34 : 35 0 : #define STICKPROFILE_TYPE_STANDARD 1 36 0 : #define STICKPROFILE_TYPE_SPLINE 2 37 0 : #define STICKPROFILE_MAX_POWER 10.0 38 : 39 0 : @interface OOJoystickAxisProfile : NSObject <NSCopying> 40 : { 41 : @private 42 : double deadzone; 43 0 : } 44 : 45 : - (id) init; 46 0 : - (id) copyWithZone: (NSZone *) zone; 47 0 : - (double) rawValue: (double) x; 48 0 : - (double) value: (double) x; 49 0 : - (double) deadzone; 50 0 : - (void) setDeadzone: (double) newValue; 51 0 : 52 : @end 53 : 54 : @interface OOJoystickStandardAxisProfile: OOJoystickAxisProfile 55 0 : { 56 : @private 57 : double power; 58 0 : double parameter; 59 0 : } 60 : 61 : - (id) init; 62 0 : - (id) copyWithZone: (NSZone *) zone; 63 0 : - (void) setPower: (double) newValue; 64 0 : - (double) power; 65 0 : - (void) setParameter: (double) newValue; 66 0 : - (double) parameter; 67 0 : - (double) rawValue: (double) x; 68 0 : 69 : @end 70 : 71 : @interface OOJoystickSplineAxisProfile: OOJoystickAxisProfile 72 0 : { 73 : @private 74 : NSMutableArray *controlPoints; 75 0 : NSArray *segments; 76 0 : } 77 : 78 : - (id) init; 79 0 : - (void) dealloc; 80 0 : - (id) copyWithZone: (NSZone *) zone; 81 0 : - (int) addControl: (NSPoint) point; 82 0 : - (NSPoint) pointAtIndex: (NSInteger) index; 83 0 : - (int) countPoints; 84 0 : - (void) removeControl: (NSInteger) index; 85 0 : - (void) clearControlPoints; 86 0 : - (void) moveControl: (NSInteger) index point: (NSPoint) point; 87 0 : - (double) rawValue: (double) x; 88 0 : - (double) gradient: (double) x; 89 0 : - (NSArray *) controlPoints; 90 0 : 91 : @end 92 :