Browse Source

Implement gamepad::InputDevice::getName().

tags/v2.0.0
Andrew Belt 5 years ago
parent
commit
e6a12cbb2d
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/gamepad.cpp

+ 7
- 0
src/gamepad.cpp View File

@@ -19,6 +19,13 @@ struct InputDevice : midi::InputDevice {
int deviceId; int deviceId;
int8_t ccs[128] = {}; int8_t ccs[128] = {};


std::string getName() override {
const char* name = glfwGetJoystickName(deviceId);
if (!name)
return "";
return name;
}

void step() { void step() {
if (!glfwJoystickPresent(deviceId)) if (!glfwJoystickPresent(deviceId))
return; return;


Loading…
Cancel
Save