I have a Samsung Galaxy Tab S2 with a resolution of 2048x1536. (https://www.gsmarena.com/samsung_galaxy_tab_s2_8_0-7439.php)
When I start my game, calling render.get_window_width () and calling render.get_window_height () returns a resolution of 1536x1152, respectively. I thought Defold didn’t return the value well, so I did a little test program. The test program, on the other hand, returns a good resolution of 2048x1536. I don’t understand what that is.
I copy the relevant section from the log for both programs.
Game:
V/glfw-android: handleCommand: APP_CMD_INIT_WINDOW
D/ViewRootImpl@f803402[DefoldActivity]: ViewRootImpl >> surfaceCreated
D/ViewRootImpl@f803402[DefoldActivity]: ViewRootImpl >> surfaceChanged W=1536, H=1152)
D/ViewRootImpl@f803402[DefoldActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1536, 1152) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
D/ViewRootImpl@f803402[DefoldActivity]: MSG_WINDOW_FOCUS_CHANGED 1
Test program:
V/glfw-android: handleCommand: APP_CMD_INIT_WINDOW
D/ViewRootImpl@6fad8e4[DefoldActivity]: ViewRootImpl >> surfaceCreated
D/ViewRootImpl@6fad8e4[DefoldActivity]: ViewRootImpl >> surfaceChanged W=2048, H=1536)
D/ViewRootImpl@6fad8e4[DefoldActivity]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 2048, 1536) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=2
D/ViewRootImpl@6fad8e4[DefoldActivity]: MSG_WINDOW_FOCUS_CHANGED 1
As you can see, Defold makes different surface sizes on the same device.
Anyone have any idea why I get two different resolutions for the two programs?