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