forked from Panda-K/SuperMario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SneakyJoystick.h
executable file
·58 lines (48 loc) · 1.76 KB
/
SneakyJoystick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// joystick.h
// SneakyJoystick
//
// Created by Nick Pannuto.
// 2/15/09 verion 0.1
//
// WIKI: http://wiki.github.com/sneakyness/SneakyJoystick/
// HTTP SRC: http://github.com/sneakyness/SneakyJoystick.git
// GIT: git://github.com/sneakyness/SneakyJoystick.git
// Email: [email protected]
// IRC: #cocos2d-iphone irc.freenode.net
#import "cocos2d.h"
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@interface SneakyJoystick : CCNode <CCTargetedTouchDelegate> {
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
@interface SneakyJoystick : CCNode <CCMouseEventDelegate> {
#endif
CGPoint stickPosition;
float degrees;
CGPoint velocity;
BOOL autoCenter;
BOOL isDPad;
BOOL hasDeadzone; //Turns Deadzone on/off for joystick, always YES if ifDpad == YES
NSUInteger numberOfDirections; //Used only when isDpad == YES
float joystickRadius;
float thumbRadius;
float deadRadius; //Size of deadzone in joystick (how far you must move before input starts). Automatically set if isDpad == YES
//Optimizations (keep Squared values of all radii for faster calculations) (updated internally when changing joy/thumb radii)
float joystickRadiusSq;
float thumbRadiusSq;
float deadRadiusSq;
#ifdef __CC_PLATFORM_MAC
bool active;
#endif
}
@property (nonatomic, readonly) CGPoint stickPosition;
@property (nonatomic, readonly) float degrees;
@property (nonatomic, readonly) CGPoint velocity;
@property (nonatomic, assign) BOOL autoCenter;
@property (nonatomic, assign) BOOL isDPad;
@property (nonatomic, assign) BOOL hasDeadzone;
@property (nonatomic, assign) NSUInteger numberOfDirections;
@property (nonatomic, assign) float joystickRadius;
@property (nonatomic, assign) float thumbRadius;
@property (nonatomic, assign) float deadRadius;
-(id)initWithRect:(CGRect)rect;
@end