Skip to content

Commit 8e5c2ad

Browse files
committed
Gamepad (Haiku): add support
1 parent 01d3765 commit 8e5c2ad

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extern "C" {
2+
#include "gamepad.h"
3+
}
4+
#include <Joystick.h>
5+
6+
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */)
7+
{
8+
BJoystick js;
9+
for (int32 i = 0, n = js.CountDevices(); i < n; ++i)
10+
{
11+
char name[B_OS_NAME_LENGTH];
12+
if (js.GetDeviceName(i, name) == B_OK)
13+
{
14+
FFGamepadDevice* device = (FFGamepadDevice*) ffListAdd(devices);
15+
ffStrbufInit(&device->serial);
16+
ffStrbufInitS(&device->name, name);
17+
device->battery = 0;
18+
}
19+
}
20+
return NULL;
21+
}

0 commit comments

Comments
 (0)