• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

WIP Android improve multi-window support

grant

Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Nov 19, 2019
Messages
80
The games can't respond to Window resizes if they don't have focus (but are still visible) right now. It would be nice to be able to respond to it properly.

For now I did some edits to the AndroidGame class inside androidgame.java.

I moved these two lines from onWindowFocusChanged to onResume.
Code:
_view.onResume();
_game.ResumeGame();

and moved these two lines from onWindowFocusChanged to onStop.
Code:
_game.SuspendGame();
_view.onPause();

This should be added to the application tag in the manifest.
Code:
android:resizeableActivity="true"

With those edits: If the game is visible but not focused, it will still run. It will not stop unless the window is not visible to the user.

It may also be nice for games to be able to detect when they lose focus (but are still visible) so they can show pause menus.
 
And this is a fundamental change which I think would break existing code. We have a flag that turns off the suspension of APPS that don't have the focus.
 
With those edits: If the game is visible but not focused, it will still run. It will not stop unless the window is not visible to the user.

It may also be nice for games to be able to detect when they lose focus (but are still visible) so they can show pause menus.
This sounds interesting, does it behave different than #MOJO_AUTO_SUSPEND_ENABLED = False
I'm trying to wrap my head around this, what's the difference?
 
Come to think about it, this would be nice addition as I never actually succeeded at getting OnSuspend to work like Intended on Android. Having a possibility to save things before an app goes to sleep and to restore things when wakening up would be very helpful!
 
#MOJO_AUTO_SUSPEND_ENABLED didn't work for me on Android. My edits still suspend the game, but only when it's not visible. That way when the window is resized in split window mode the game can resize itself (even if it doesn't have focus). It would be on phones, tablets, and laptops. Ya, those edits will need to be tested and improved, but supporting multi-window mode will be nice (eventually it'll have to be supported).
 
Ya, those edits will need to be tested and improved, but supporting multi-window mode will be nice (eventually it'll have to be supported).
To bad, non of us have devices that can display multiple windows on Android. We only have phones. So it couldn't be supported by us.
 
Ahhh that shitty feature which always pisses me off when I accidently and somehow activate this on an app. Would never ever want this for my game. But hell ya, your mileage may vary.
 
Ok, I looked into the code. My findings so far:

#MOJO_AUTO_SUSPEND_ENABLED only works on GLFW and HTML5

That way when the window is resized in split window mode the game can resize itself (even if it doesn't have focus)
Use OnResize to determine the new DeviceWidth and DeviceHeight, works fine for me.

The rest I will look into more tomorrow evening.
 
Back
Top Bottom