ObjFW  Check-in [f8b2baa0f5]

Overview
Comment:tests/gamecontroller: Print read errors
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f8b2baa0f5318b5e31770472fe329212f2b5dade6ba7f1242bb39de9f3194622
User & Date: js on 2024-05-20 19:41:45
Other Links: manifest | tags
Context
2024-05-20
21:48
OFGameController: Improve right stick emulation check-in: 8c81efc528 user: js tags: trunk
19:41
tests/gamecontroller: Print read errors check-in: f8b2baa0f5 user: js tags: trunk
19:38
OFEvdevGameController: Poll HAT0[XY] for D-Pad check-in: f99cb23d38 user: js tags: trunk
Changes

Modified tests/gamecontroller/GameControllerTests.m from [9d9395a639] to [bb51f5cad3].

25
26
27
28
29
30
31


32
33
34
35
36
37
38
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40







+
+







#import "OFDate.h"
#import "OFGameController.h"
#import "OFNumber.h"
#import "OFSet.h"
#import "OFStdIOStream.h"
#import "OFThread.h"

#import "OFReadFailedException.h"

#if defined(OF_NINTENDO_DS)
static size_t buttonsPerLine = 2;
#elif defined(OF_NINTENDO_3DS)
static size_t buttonsPerLine = 3;
#else
static size_t buttonsPerLine = 5;
#endif
79
80
81
82
83
84
85

86






87
88
89
90
91
92
93
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
99
100
101







+
-
+
+
+
+
+
+







			OFArray OF_GENERIC(OFGameControllerButton) *buttons =
			    controller.buttons.allObjects.sortedArray;
			size_t i = 0;

			[OFStdOut setForegroundColor: [OFColor green]];
			[OFStdOut writeString: controller.description];

			@try {
			[controller retrieveState];
				[controller retrieveState];
			} @catch (OFReadFailedException *e) {
				[OFStdOut setForegroundColor: [OFColor red]];
				[OFStdOut writeFormat: @"\n%@", e.description];
				continue;
			}

			for (OFGameControllerButton button in buttons) {
				float pressure;

				if (i == 0)
					[OFStdOut writeString: @"\n"];