ObjFW  Diff

Differences From Artifact [680cfba800]:

To Artifact [c04fc09244]:


17
18
19
20
21
22
23













24
25
26
27
28
29
30
 * <https://www.gnu.org/licenses/>.
 */

#include "config.h"

#import "OFGameController.h"
#import "OFArray.h"














const OFGameControllerButton OFGameControllerNorthButton = @"North";
const OFGameControllerButton OFGameControllerSouthButton = @"South";
const OFGameControllerButton OFGameControllerWestButton = @"West";
const OFGameControllerButton OFGameControllerEastButton = @"East";
const OFGameControllerButton OFGameControllerLeftTriggerButton =
    @"Left Trigger";







>
>
>
>
>
>
>
>
>
>
>
>
>







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
 * <https://www.gnu.org/licenses/>.
 */

#include "config.h"

#import "OFGameController.h"
#import "OFArray.h"

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include "OFEvdevGameController.h"
#endif
#ifdef OF_WINDOWS
# include "OFXInputGameController.h"
#endif
#ifdef OF_NINTENDO_DS
# include "OFNintendoDSGameController.h"
#endif
#ifdef OF_NINTENDO_3DS
# include "OFNintendo3DSGameController.h"
#endif

const OFGameControllerButton OFGameControllerNorthButton = @"North";
const OFGameControllerButton OFGameControllerSouthButton = @"South";
const OFGameControllerButton OFGameControllerWestButton = @"West";
const OFGameControllerButton OFGameControllerEastButton = @"East";
const OFGameControllerButton OFGameControllerLeftTriggerButton =
    @"Left Trigger";
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78









79

80
81
82
83







84




85
86
87
88
89
90
91
92
93
94
95
96
97
98

99
100
101
102
103

104
105



106









const OFGameControllerButton OFGameControllerPlusButton = @"+";
const OFGameControllerButton OFGameControllerMinusButton = @"-";
const OFGameControllerButton OFGameControllerSLButton = @"SL";
const OFGameControllerButton OFGameControllerSRButton = @"SR";
const OFGameControllerButton OFGameControllerModeButton = @"Mode";
const OFGameControllerButton OFGameControllerAssistantButton = @"Assistant";

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include "platform/Linux/OFGameController.m"
#elif defined(OF_WINDOWS)
# include "platform/Windows/OFGameController.m"
#elif defined(OF_NINTENDO_DS)
# include "platform/NintendoDS/OFGameController.m"
#elif defined(OF_NINTENDO_3DS)
# include "platform/Nintendo3DS/OFGameController.m"
#else
@implementation OFGameController
@dynamic name, buttons, pressedButtons, hasLeftAnalogStick;
@dynamic leftAnalogStickPosition, hasRightAnalogStick, rightAnalogStickPosition;

+ (OFArray OF_GENERIC(OFGameController *) *)controllers
{









	return [OFArray array];

}

- (instancetype)init
{







	OF_INVALID_INIT_METHOD




}

- (OFNumber *)vendorID
{
	return nil;
}

- (OFNumber *)productID
{
	return nil;
}

- (void)retrieveState
{

}

- (float)pressureForButton: (OFGameControllerButton)button
{
	return 0;

}
@end



#endif
















<
<
<
<
<
<
<
<
<






>
>
>
>
>
>
>
>
>

>




>
>
>
>
>
>
>
|
>
>
>
>














>




<
>


>
>
>

>
>
>
>
>
>
>
>
>
70
71
72
73
74
75
76









77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
const OFGameControllerButton OFGameControllerPlusButton = @"+";
const OFGameControllerButton OFGameControllerMinusButton = @"-";
const OFGameControllerButton OFGameControllerSLButton = @"SL";
const OFGameControllerButton OFGameControllerSRButton = @"SR";
const OFGameControllerButton OFGameControllerModeButton = @"Mode";
const OFGameControllerButton OFGameControllerAssistantButton = @"Assistant";










@implementation OFGameController
@dynamic name, buttons, pressedButtons, hasLeftAnalogStick;
@dynamic leftAnalogStickPosition, hasRightAnalogStick, rightAnalogStickPosition;

+ (OFArray OF_GENERIC(OFGameController *) *)controllers
{
#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
	return [OFEvdevGameController controllers];
#elif defined(OF_WINDOWS)
	return [OFXInputGameController controllers];
#elif defined(OF_NINTENDO_DS)
	return [OFNintendoDSGameController controllers];
#elif defined(OF_NINTENDO_3DS)
	return [OFNintendo3DSGameController controllers];
#else
	return [OFArray array];
#endif
}

- (instancetype)init
{
	if ([self isMemberOfClass: [OFGameController class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}

		abort();
	}

	return [super init];
}

- (OFNumber *)vendorID
{
	return nil;
}

- (OFNumber *)productID
{
	return nil;
}

- (void)retrieveState
{
	OF_UNRECOGNIZED_SELECTOR
}

- (float)pressureForButton: (OFGameControllerButton)button
{

	OF_UNRECOGNIZED_SELECTOR
}
@end

#if defined(OF_LINUX) && defined(OF_HAVE_FILES)
# include "OFEvdevGameController.m"
#endif
#ifdef OF_WINDOWS
# include "OFXInputGameController.m"
#endif
#ifdef OF_NINTENDO_DS
# include "OFNintendoDSGameController.m"
#endif
#ifdef OF_NINTENDO_3DS
# include "OFNintendo3DSGameController.m"
#endif