master #4

Merged
BRNSystems merged 17 commits from Mirrorlandia_minetest/irrlicht:master into master 2024-01-28 00:16:35 +01:00
3 changed files with 13 additions and 6 deletions
Showing only changes of commit 66786d0059 - Show all commits

@ -178,7 +178,10 @@ namespace irr
virtual bool isFullscreen() const = 0; virtual bool isFullscreen() const = 0;
//! Checks if the window could possibly be visible. //! Checks if the window could possibly be visible.
//! Currently, this only returns false when the app is paused on Android. //! Currently, this only returns false when the activity is stopped on
//! Android. Note that for Android activities, "stopped" means something
//! different than you might expect (and also something different than
//! "paused"). Read the Android lifecycle documentation.
virtual bool isWindowVisible() const { return true; }; virtual bool isWindowVisible() const { return true; };
//! Get the current color format of the window //! Get the current color format of the window

@ -31,7 +31,8 @@ namespace irr
{ {
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param) CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Focused(false), Initialized(false), Paused(true), JNIEnvAttachedToVM(0) : CIrrDeviceStub(param), Accelerometer(0), Gyroscope(0), Initialized(false),
Stopped(true), Paused(true), Focused(false), JNIEnvAttachedToVM(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CIrrDeviceAndroid"); setDebugName("CIrrDeviceAndroid");
@ -64,7 +65,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
s32 Events = 0; s32 Events = 0;
android_poll_source* Source = 0; android_poll_source* Source = 0;
while ((ALooper_pollAll(((Focused && !Paused) || !Initialized) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0) while ((ALooper_pollAll((!Initialized || isWindowActive()) ? 0 : -1, 0, &Events, (void**)&Source)) >= 0)
{ {
if(Source) if(Source)
Source->process(Android, Source); Source->process(Android, Source);
@ -180,7 +181,7 @@ void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
bool CIrrDeviceAndroid::isWindowActive() const bool CIrrDeviceAndroid::isWindowActive() const
{ {
return (Focused && !Paused); return (Focused && !Paused && !Stopped);
} }
bool CIrrDeviceAndroid::isWindowFocused() const bool CIrrDeviceAndroid::isWindowFocused() const
@ -195,7 +196,7 @@ bool CIrrDeviceAndroid::isWindowMinimized() const
bool CIrrDeviceAndroid::isWindowVisible() const bool CIrrDeviceAndroid::isWindowVisible() const
{ {
return !Paused; return !Stopped;
} }
void CIrrDeviceAndroid::closeDevice() void CIrrDeviceAndroid::closeDevice()
@ -265,6 +266,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
break; break;
case APP_CMD_START: case APP_CMD_START:
os::Printer::log("Android command APP_CMD_START", ELL_DEBUG); os::Printer::log("Android command APP_CMD_START", ELL_DEBUG);
device->Stopped = false;
break; break;
case APP_CMD_INIT_WINDOW: case APP_CMD_INIT_WINDOW:
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG); os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
@ -322,6 +324,7 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
break; break;
case APP_CMD_STOP: case APP_CMD_STOP:
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG); os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
device->Stopped = true;
break; break;
case APP_CMD_RESUME: case APP_CMD_RESUME:
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG); os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);

@ -86,9 +86,10 @@ namespace irr
const ASensor* Accelerometer; const ASensor* Accelerometer;
const ASensor* Gyroscope; const ASensor* Gyroscope;
bool Focused;
bool Initialized; bool Initialized;
bool Stopped;
bool Paused; bool Paused;
bool Focused;
JNIEnv* JNIEnvAttachedToVM; JNIEnv* JNIEnvAttachedToVM;