MCPcopy Create free account
hub / github.com/axmolengine/axmol / startDiscoveryController

Method startDiscoveryController

core/base/Controller-linux-win32.cpp:4398–4419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4396 ControllerImpl::s_controllerProfiles;
4397
4398void 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
4421void Controller::stopDiscoveryController()
4422{

Callers

nothing calls this directly

Calls 8

glfwJoystickPresentFunction · 0.85
glfwGetJoystickAxesFunction · 0.85
glfwGetJoystickButtonsFunction · 0.85
glfwGetJoystickNameFunction · 0.85
onConnectedFunction · 0.85
glfwSetJoystickCallbackFunction · 0.85
getInstanceFunction · 0.85
scheduleUpdateMethod · 0.80

Tested by

no test coverage detected