Problems with controller events in release mode #1986
Replies: 5 comments 10 replies
-
How it is not working in release mode, i put some error log to force show messages in console since in release it only show error messages, and the only message in console is the first bool EventListenerController::init()
{
AXLOGE("EventListenerController::init");
auto listener = [this](Event* event) {
auto evtController = static_cast<EventController*>(event);
switch (evtController->getControllerEventType())
{
case EventController::ControllerEventType::CONNECTION:
AXLOGE("EventController::ControllerEventType::CONNECTION - {}", evtController->isConnected());
if (evtController->isConnected())
{
if (this->onConnected)
this->onConnected(evtController->getController(), event);
}
else
{
if (this->onDisconnected)
this->onDisconnected(evtController->getController(), event);
}
break;
case EventController::ControllerEventType::BUTTON_STATUS_CHANGED:
{
AXLOGE("EventController::ControllerEventType::BUTTON_STATUS_CHANGED - {}", evtController->_keyCode);
const auto& keyStatus = evtController->_controller->_allKeyStatus[evtController->_keyCode];
const auto& keyPrevStatus = evtController->_controller->_allKeyPrevStatus[evtController->_keyCode];
if (this->onKeyDown && keyStatus.isPressed && !keyPrevStatus.isPressed)
{
this->onKeyDown(evtController->_controller, evtController->_keyCode, event);
}
else if (this->onKeyUp && !keyStatus.isPressed && keyPrevStatus.isPressed)
{
this->onKeyUp(evtController->_controller, evtController->_keyCode, event);
}
else if (this->onKeyRepeat && keyStatus.isPressed && keyPrevStatus.isPressed)
{
this->onKeyRepeat(evtController->_controller, evtController->_keyCode, event);
}
}
break;
case EventController::ControllerEventType::AXIS_STATUS_CHANGED:
{
if (this->onAxisEvent)
{
this->onAxisEvent(evtController->_controller, evtController->_keyCode, event);
}
}
break;
default:
AXASSERT(false, "Invalid EventController type");
break;
}
};
if (EventListener::init(EventListener::Type::GAME_CONTROLLER, LISTENER_ID, listener))
{
return true;
}
return false;
} |
Beta Was this translation helpful? Give feedback.
-
To verify whether the issue is caused by compiler optimizations in release mode, you should try changing the Optimization Level for the release configuration to None [-O0]. This will disable all compiler optimizations and help you determine if the optimizations are the source of the problem. |
Beta Was this translation helpful? Give feedback.
-
I think that there is a bug in Axmol @rh101 because when i set the macro |
Beta Was this translation helpful? Give feedback.
-
I still don't know what is wrong. I created a new project and put the same code, a scene with fairygui and listener for events and it is working. |
Beta Was this translation helpful? Give feedback.
-
Hi, I solve the problem and this is the code changes: Basically, in release it don't work (don't ask me why):
What i do is get the event from scene and send to UI class. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Im testing my game on AppleTV in debug/release (debug and release from xcode and release from testflight), but i have a problem with GameController in release mode.
In debug it works perfect, but if i run in release mode, the events don't come.
Anyone knows what can be wrong?
I have this test code that is a fairygui window:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions