File: JOYController.h

package info (click to toggle)
sameboy 1.0.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,632 kB
  • sloc: ansic: 29,954; objc: 22,249; asm: 1,424; pascal: 1,373; makefile: 1,064; xml: 111
file content (68 lines) | stat: -rw-r--r-- 2,268 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
#import <Foundation/Foundation.h>
#import "JOYButton.h"
#import "JOYAxis.h"
#import "JOYAxes2D.h"
#import "JOYAxes3D.h"
#import "JOYHat.h"

static NSString const *JOYAxes2DEmulateButtonsKey = @"JOYAxes2DEmulateButtons";
static NSString const *JOYHatsEmulateButtonsKey = @"JOYHatsEmulateButtons";

@class JOYController;

@protocol JOYListener <NSObject>

@optional
-(void) controllerConnected:(JOYController *)controller;
-(void) controllerDisconnected:(JOYController *)controller;
-(void) controller:(JOYController *)controller buttonChangedState:(JOYButton *)button;
-(void) controller:(JOYController *)controller movedAxis:(JOYAxis *)axis;
-(void) controller:(JOYController *)controller movedAxes2D:(JOYAxes2D *)axes;
-(void) controller:(JOYController *)controller movedAxes3D:(JOYAxes3D *)axes;
-(void) controller:(JOYController *)controller movedHat:(JOYHat *)hat;

@end

typedef enum {
    JOYControllerCombinedTypeSingle,
    JOYControllerCombinedTypeComponent,
    JOYControllerCombinedTypeCombined,
} JOYControllerCombinedType;

typedef enum {
    JOYJoyConTypeNone,
    JOYJoyConTypeLeft,
    JOYJoyConTypeRight,
    JOYJoyConTypeDual,
} JOYJoyConType;

@interface JOYController : NSObject
+ (void)startOnRunLoop:(NSRunLoop *)runloop withOptions: (NSDictionary *)options;
+ (NSArray<JOYController *> *) allControllers;
+ (void) registerListener:(id<JOYListener>)listener;
+ (void) unregisterListener:(id<JOYListener>)listener;
- (JOYControllerCombinedType)combinedControllerType;
- (NSArray<JOYButton *> *) buttons;
- (NSArray<JOYAxis *> *) axes;
- (NSArray<JOYAxes2D *> *) axes2D;
- (NSArray<JOYAxes3D *> *) axes3D;
- (NSArray<JOYHat *> *) hats;
- (NSArray<JOYInput *> *) allInputs;
- (void)setRumbleAmplitude:(double)amp;
- (void)setPlayerLEDs:(uint8_t)mask;
- (uint8_t)LEDMaskForPlayer:(unsigned)player;
@property (readonly, getter=isConnected) bool connected;
@property (readonly) JOYJoyConType joyconType;
@property (readonly) NSString *deviceName;
@property (readonly) NSString *uniqueID;
@property (nonatomic) bool usesHorizontalJoyConGrip;
@end

@interface JOYCombinedController : JOYController
- (instancetype)initWithChildren:(NSArray<JOYController *> *)children;
- (void)breakApart;
@property (readonly) NSArray<JOYController *> *children;
@end