blob: 50b43a04343edcee27c51054ecfae0f6d92e9c82 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
extern "C" {
#include "gamepad.h"
}
#include <Joystick.h>
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */) {
BJoystick js;
for (int32 i = 0, n = js.CountDevices(); i < n; ++i) {
char name[B_OS_NAME_LENGTH];
if (js.GetDeviceName(i, name) == B_OK) {
FFGamepadDevice* device = FF_LIST_ADD(FFGamepadDevice, *devices);
ffStrbufInit(&device->serial);
ffStrbufInitS(&device->name, name);
device->battery = 0;
}
}
return NULL;
}
|