ObjFW  Check-in [551a37ad2e]

Overview
Comment:OFGameController: Fix analog stick on 3DS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | gamecontroller
Files: files | file ages | folders
SHA3-256: 551a37ad2ef0f175fbecc19bb41d41fb040de251cb90cbd5249b555d3ee44760
User & Date: js on 2024-05-19 00:21:21
Other Links: branch diff | manifest | tags
Context
2024-05-19
14:18
Make game controller tests work on Nintendo DS check-in: ca175fe9db user: js tags: gamecontroller
00:21
OFGameController: Fix analog stick on 3DS check-in: 551a37ad2e user: js tags: gamecontroller
00:11
Make game controller tests work on 3DS check-in: efeac48cc3 user: js tags: gamecontroller
Changes

Modified src/hid/OFNintendo3DSGameController.m from [ab4d725506] to [c19a2f1b59].

122
123
124
125
126
127
128
129









130
131
132
133
134
135
136
137
138
139
		[_pressedButtons addObject: OFGameControllerCPadUpButton];
	if (keys & KEY_CSTICK_DOWN)
		[_pressedButtons addObject: OFGameControllerCPadDownButton];
	if (keys & KEY_CSTICK_LEFT)
		[_pressedButtons addObject: OFGameControllerCPadLeftButton];
	if (keys & KEY_CSTICK_RIGHT)
		[_pressedButtons addObject: OFGameControllerCPadRightButton];










	_leftAnalogStickPosition = OFMakePoint(
	    (float)pos.dx / (pos.dx < 0 ? -INT16_MIN : INT16_MAX),
	    (float)pos.dy / (pos.dy < 0 ? -INT16_MIN : INT16_MAX));
}

- (OFString *)name
{
	return @"Nintendo 3DS";
}









>
>
>
>
>
>
>
>
>

|
<







122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
		[_pressedButtons addObject: OFGameControllerCPadUpButton];
	if (keys & KEY_CSTICK_DOWN)
		[_pressedButtons addObject: OFGameControllerCPadDownButton];
	if (keys & KEY_CSTICK_LEFT)
		[_pressedButtons addObject: OFGameControllerCPadLeftButton];
	if (keys & KEY_CSTICK_RIGHT)
		[_pressedButtons addObject: OFGameControllerCPadRightButton];

	if (pos.dx > 150)
		pos.dx = 150;
	if (pos.dx < -150)
		pos.dx = -150;
	if (pos.dy > 150)
		pos.dy = 150;
	if (pos.dy < -150)
		pos.dy = -150;

	_leftAnalogStickPosition = OFMakePoint(
	    (float)pos.dx / 150, -(float)pos.dy / 150);

}

- (OFString *)name
{
	return @"Nintendo 3DS";
}