Contentheight or contentwidth wrong on samsung fold

One of my testers tried a game on their Samsung Fold 3, and the aspect ratio is all wrong. I have a simple test to see if the device is a tablet, if the height/width is > 0.6. The Samsung Fold 3 has a ratio of 0.8, but is not registered as a tablet.

Here is what I use:

_G.ASPRAT = display.actualContentHeight/display.actualContentWidth

I assume something is getting confused with the two ‘screens’. Is there something special I need to do to detect this properly on that device?

I’m not sure. My first thought would be that maybe you aren’t updating the variable after the screen resize event?

I have a screen module that should handle all screen size related issues, but I haven’t tried it on devices with folds. It should work (famous last words).

Maybe you could download and build it, and send an apk to your tester to see if the screen dimensions are correctly identified on their devices before and after folding? If it works, then you can take a look at what we are doing differently and what the missing ingredient might be.

1 Like

Thank you, that sounds right. I am testing a version now that forces a re-calculate when the game starts (so much later than resize), assuming something like that, but your solution is much better. I will try it.

So, I just need to do

screen.setCallback

Is that all? Sounds perfect.

For the demo project, you shouldn’t need to do anything. It’ll handle the updates and all by itself.

The screen.setCallback() would be if you want it to call some additional function after it has finished resizing the screen, like updating your display object positions, etc.

Yes, I understood that. I put all of my screen calculations in a function for that callback. I put it in my app, waiting for my tester to try it out. Will let you know.

Recalculating works fine, my app is corrected. I have not done your full app for all calculations, but the aspect ratio is correct.

Thank you, @XeduR !