Remove use of deprecated ALooper_pollAll

This commit is contained in:
Chris Thrasher 2024-08-05 15:15:31 -06:00
parent dffdaa52a7
commit 6b4da70e15
3 changed files with 12 additions and 6 deletions

View File

@ -166,7 +166,8 @@ void setVirtualKeyboardVisible(bool visible)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool isMouseButtonPressed(Mouse::Button button) bool isMouseButtonPressed(Mouse::Button button)
{ {
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
const std::lock_guard lock(states.mutex); const std::lock_guard lock(states.mutex);
@ -178,7 +179,8 @@ bool isMouseButtonPressed(Mouse::Button button)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i getMousePosition() Vector2i getMousePosition()
{ {
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
const std::lock_guard lock(states.mutex); const std::lock_guard lock(states.mutex);
@ -211,7 +213,8 @@ void setMousePosition(Vector2i position, const WindowBase& /* relativeTo */)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool isTouchDown(unsigned int finger) bool isTouchDown(unsigned int finger)
{ {
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
const std::lock_guard lock(states.mutex); const std::lock_guard lock(states.mutex);
@ -223,7 +226,8 @@ bool isTouchDown(unsigned int finger)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i getTouchPosition(unsigned int finger) Vector2i getTouchPosition(unsigned int finger)
{ {
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
const std::lock_guard lock(states.mutex); const std::lock_guard lock(states.mutex);

View File

@ -120,7 +120,8 @@ void SensorImpl::close()
Vector3f SensorImpl::update() const Vector3f SensorImpl::update() const
{ {
// Update our sensor data list // Update our sensor data list
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
return sensorData[m_type]; return sensorData[m_type];
} }

View File

@ -101,7 +101,8 @@ WindowHandle WindowImplAndroid::getNativeHandle() const
void WindowImplAndroid::processEvents() void WindowImplAndroid::processEvents()
{ {
// Process incoming OS events // Process incoming OS events
ALooper_pollAll(0, nullptr, nullptr, nullptr); while (ALooper_pollOnce(0, nullptr, nullptr, nullptr) >= 0)
;
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
const std::lock_guard lock(states.mutex); const std::lock_guard lock(states.mutex);