| 4396 | ControllerImpl::s_controllerProfiles; |
| 4397 | |
| 4398 | void Controller::startDiscoveryController() |
| 4399 | { |
| 4400 | // Check for existing josyticks and register them as ax::Controller: |
| 4401 | for (int deviceId = GLFW_JOYSTICK_1; deviceId <= GLFW_JOYSTICK_LAST; ++deviceId) |
| 4402 | { |
| 4403 | if (glfwJoystickPresent(deviceId)) |
| 4404 | { |
| 4405 | int axis_count, button_count; |
| 4406 | glfwGetJoystickAxes(deviceId, &axis_count); |
| 4407 | glfwGetJoystickButtons(deviceId, &button_count); |
| 4408 | const char* name = glfwGetJoystickName(deviceId); |
| 4409 | ControllerImpl::onConnected(name, deviceId); |
| 4410 | } |
| 4411 | } |
| 4412 | |
| 4413 | // GFLW sends events when a joystick is connected and disconnected only. |
| 4414 | // These events need to be filtered: |
| 4415 | glfwSetJoystickCallback(ControllerImpl::handleConnectionsAndDisconnections); |
| 4416 | |
| 4417 | // Poll the joystick axis and buttons |
| 4418 | Director::getInstance()->getScheduler()->scheduleUpdate(ControllerImpl::getInstance(), 0, false); |
| 4419 | } |
| 4420 | |
| 4421 | void Controller::stopDiscoveryController() |
| 4422 | { |
nothing calls this directly
no test coverage detected