Post by potchy on Feb 2, 2019 15:12:29 GMT
Hello again.
As you might remember, I play a called Fate Grand/Order which has these borders around it when the device's screen is not 16:9.
To solve this problem, we've coded a function that calculates the correct area for AnkuLua to work on.
Now, we're also using that new getGameArea() function to handle notches, which may further extend the game's horizontal offset, like in the example below.
You can see the scaling code here, if you're curious.
It's working great for everyone, except for this guy who owns a ZenFone 5Z (ZS620KL).
As you can see on the phone's official page and on the screenshot below, this phone has a screen resolution of 2246x1080 and a 87px notch.
Here's the code for the dialog above.
getRealScreenSize() and getGameArea() return values look correct when the device is in portrait mode, but here's what happens when it's in landscape:
For some reason, getRealScreenSize() returns 2159x1080 instead of 2246x1080. The difference in width is precisely 87.
I assume getGameArea() internally uses getRealScreenSize() to do its calculations, so it returns Region(87, 0, 2072, 1080) instead of Region(87, 0, 2159, 1080).
We also tried to hardcode the supposedly correct regions for his device, but the coordinates seem a bit off.
1st attempt (considering the notch):
2nd attempt (supposing that his phone actually changes its resolution to 2159x1080 in landscape mode):
To be perfectly honest, I don't understand what's going on.
Do you have any idea?
As you might remember, I play a called Fate Grand/Order which has these borders around it when the device's screen is not 16:9.
To solve this problem, we've coded a function that calculates the correct area for AnkuLua to work on.
Now, we're also using that new getGameArea() function to handle notches, which may further extend the game's horizontal offset, like in the example below.
You can see the scaling code here, if you're curious.
It's working great for everyone, except for this guy who owns a ZenFone 5Z (ZS620KL).
As you can see on the phone's official page and on the screenshot below, this phone has a screen resolution of 2246x1080 and a 87px notch.
Here's the code for the dialog above.
setImmersiveMode(true)
autoGameArea(true)
local HIGHLIGHT_REGION = Region(0, 0, getRealScreenSize():getX(), getRealScreenSize():getY())
HIGHLIGHT_REGION:highlight()
dialogInit()
local message = "getRealScreenSize(): %ix%i\n"
message = message .. "getGameArea() with setImmersiveMode(true) and autoGameArea(true): Region(%i, %i, %i, %i)"
message = message:format(getRealScreenSize():getX(), getRealScreenSize():getY()
, getGameArea():getX(), getGameArea():getY(), getGameArea():getW(), getGameArea():getH())
addTextView(message)
dialogShow("Resolution")
HIGHLIGHT_REGION:highlightOff()
getRealScreenSize() and getGameArea() return values look correct when the device is in portrait mode, but here's what happens when it's in landscape:
For some reason, getRealScreenSize() returns 2159x1080 instead of 2246x1080. The difference in width is precisely 87.
I assume getGameArea() internally uses getRealScreenSize() to do its calculations, so it returns Region(87, 0, 2072, 1080) instead of Region(87, 0, 2159, 1080).
We also tried to hardcode the supposedly correct regions for his device, but the coordinates seem a bit off.
1st attempt (considering the notch):
setImmersiveMode(true)
local HIGHLIGHT_REGION = Region(207,0,1920,1080) -- 207 = ((2246 [screen width] - 1920 [game width] - 87 [notch]) / 2) + 87 [notch]
HIGHLIGHT_REGION:highlight()
dialogInit()
addTextView("Press OK to clear the highlight.")
dialogShow()
HIGHLIGHT_REGION:highlightOff()
2nd attempt (supposing that his phone actually changes its resolution to 2159x1080 in landscape mode):
setImmersiveMode(true)
local HIGHLIGHT_REGION = Region(120,0,1920,1080) -- 120 = (2159 [screen width?] - 1920 [game width]) / 2
HIGHLIGHT_REGION:highlight()
dialogInit()
addTextView("Press OK to clear the highlight.")
dialogShow()
HIGHLIGHT_REGION:highlightOff()
To be perfectly honest, I don't understand what's going on.
Do you have any idea?