IOS Zoomed mode problem.
Monkey does not size it's window to the full extent, when iPhone has it's setting to "Zoomed" (goto Settings, display & Brightness, “Display Zoom.” turned on )
Forum topic: [http://monkeycoder.co.nz/forums/topic/how-can-i-get-the-device-width-and-height]
As you can see on the forum , Monkey 2 Window is 1136x640, but iPhone screen is 1364x750
To reproduce, you must also have a complete launch screen image set, can be made with [https://github.com/raphaelhanneken/Iconizer/releases]
To reproduce:
Namespace myapp
#Import "<std>"
#Import "<mojo>"
Using std..
Using mojo..
Class MyWindow Extends Window
Field _nw:Int
Field _nh:Int
Method New( title:String="Size test mojo app",width:Int,height:Int,flags:WindowFlags=Null )
Super.New( title,width,height,flags )
_nw = Width
_nh = Height
End
Method OnRender( canvas:Canvas ) Override
App.RequestRender()
canvas.Clear(Color.Red)
canvas.Color = Color.DarkGrey
canvas.DrawRect(RenderRect)
canvas.Color = Color.White
canvas.DrawText( "NWidth: " + _nw + " NHeight: " + _nh,Width/2,Height/2,.5,.5 )
canvas.DrawText( "Width: " + Width + " Height: " + Height,Width/2,Height/2+40,.5,.5 )
End
End
Function Main()
Local app:=New AppInstance
#If __DESKTOP_TARGET__
Local win:= New MyWindow("test",640,480)
#Elseif __MOBILE_TARGET__
Local win:= New MyWindow("test",3000,3000, WindowFlags.HighDPI | WindowFlags.Fullscreen )
#endif
App.Run()
End
Found out that "Note that iPhone 6 will use the 320pt (640px) resolution if you have enabled the 'Display Zoom' in iPhone > Settings > Display & Brightness > View."
[https://stackoverflow.com/questions/25754942/how-to-enable-native-resolution-for-apps-on-iphone-6-and-6-plus/25755436#25755436]
So Monkey Window should probably fit that when zoomed mode is on.
The following test shows desktop size=568,320 (ie: non-retina) and window rect=1136,640.
Not quite sure what to do about desktop size yet, but apart from that is this correct? Anything else I need to do?
Namespace myapp
#Import "<std>"
#Import "<mojo>"
Using std..
Using mojo..
Global size:Vec2i
Class MyWindow Extends Window
Method New( title:String="Simple mojo app",width:Int=640,height:Int=480,flags:WindowFlags=Null )
Super.New( title,width,height,flags|WindowFlags.HighDPI|WindowFlags.Fullscreen )
ClearColor=Color.Red
End
Method OnRender( canvas:Canvas ) Override
App.RequestRender()
canvas.DrawText( "Hello World! size="+size+", width="+Width+", height="+Height,Width/2,Height/2,.5,.5 )
End
End
Function Main()
New AppInstance
size=App.DesktopSize
New MyWindow
App.Run()
End
sdl2 snippet searching __IPHONE_8_0 definition makes educational reading
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
/* Set the scale to the natural scale factor of the screen - the
* backing dimensions of the OpenGL view will match the pixel
* dimensions of the screen rather than the dimensions in points. */
#ifdef __IPHONE_8_0
if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) {
scale = data.uiwindow.screen.nativeScale;
} else
#endif
I tried to reproduce in the simulator (by deleting splash screen 750x1364), but alas I can only make it happen on the real device. Let me know if theres is anything I can hack away at myself to test. Thanks for making the simulator target btw! :-)
Umm, what exactly am I expected to do?
According to your second post above, 640 res is 'normal' if zoom is enabled?
On Mon, Feb 5, 2018 at 3:56 AM, Difference [email protected] wrote:
I tried to reproduce in the simulator (by deleting splash screen 750x1364), but alas I can only make it happen on the real device. Let me know if theres is anything I can hack away at myself to test. Thanks for making the simulator target btw! :-)
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blitz-research/monkey2/issues/331#issuecomment-362912508, or mute the thread https://github.com/notifications/unsubscribe-auth/ADU3QihfEEq6bb4AUkg_hJQGKIUP3a7dks5tRcUzgaJpZM4R4UP7 .
sdl2 snippet searching __IPHONE_8_0 definition makes educational reading
To you maybe but I personally have no idea WTF is going on. Mobile stuff always makes me feel like I've recently undergone some kind of lobotomy...
Although I guess the nativeScale property looks like it could be useful for finding 'real pixel res'?
According to your second post above, 640 res is 'normal' if zoom is enabled? Yes, I think you are right, it should go to 640, but it looks wrong because it does not fit to the screen as seen in this screenshot.

Aha, that I can not reproduce.
If I open a fullscreen window on an iphone 6 simulator, I also get a 1136x640 window (implying simulator has 'scaling' enabled or it'd be 750?) but it cleanly fits the whole display.
So for now, I'm stumped again sorry.
On Mon, Feb 5, 2018 at 11:37 AM, Difference [email protected] wrote:
According to your second post above, 640 res is 'normal' if zoom is enabled? Yes, I think you are right, it should go to 640, but it looks wrong because it does not fit to the screen as seen in this screenshot. [image: d3ajebmi9pvsjgw63nac1dn8cjen797a] https://user-images.githubusercontent.com/142553/35783243-3ff4207c-0a04-11e8-93ed-2ad55a889b14.png
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blitz-research/monkey2/issues/331#issuecomment-362946280, or mute the thread https://github.com/notifications/unsubscribe-auth/ADU3QtgAX7ExdUWiSzNfOSla7X7pzuQfks5tRjEXgaJpZM4R4UP7 .
Any chance of you getting your hands on a iPhone 6 or similar? I have spent a day trying fixing this from the Monkey /Xcode side of things with no luck.
Nope.
On Tue, Feb 6, 2018 at 8:41 AM, Difference [email protected] wrote:
Any chance of you getting your hands on a iPhone 6 or similar? I have spent a day trying fixing this from the Monkey /Xcode side of things with no luck.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blitz-research/monkey2/issues/331#issuecomment-363197926, or mute the thread https://github.com/notifications/unsubscribe-auth/ADU3Qo5z9vbF9OHBxnrvuY00wxgwxgGHks5tR1lUgaJpZM4R4UP7 .
Can you try and diagnose more? What size is it with zoom off? Does fullscreen flag do anything etc? How many pixels 'off' is the rect?
You've given me very little to go on here...
On Tue, Feb 6, 2018 at 9:01 AM, Mark Sibly [email protected] wrote:
Nope.
On Tue, Feb 6, 2018 at 8:41 AM, Difference [email protected] wrote:
Any chance of you getting your hands on a iPhone 6 or similar? I have spent a day trying fixing this from the Monkey /Xcode side of things with no luck.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blitz-research/monkey2/issues/331#issuecomment-363197926, or mute the thread https://github.com/notifications/unsubscribe-auth/ADU3Qo5z9vbF9OHBxnrvuY00wxgwxgGHks5tR1lUgaJpZM4R4UP7 .
I've made a little progress: By hardcoding a size into mojo->window->GetFrame() I can make the rendering fill the screen. I'll make some more experiments and report back.
This is obviously only debuggable on a physical device.
Sounds promising!
On Wed, Feb 7, 2018 at 9:07 PM, Difference [email protected] wrote:
I've made a little progress: By hardcoding a size into mojo->window->GetFrame() I can make the rendering fill the screen. I'll make some more experiments and report back.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/blitz-research/monkey2/issues/331#issuecomment-363688470, or mute the thread https://github.com/notifications/unsubscribe-auth/ADU3QjIvySnKZ-I4V6tJJFx8bZCkBJIfks5tSVmzgaJpZM4R4UP7 .
Progress! In mojo->window->GetFrame() _mousescale is truncated to it's integer part. Replacing Return New Recti( x,y,x+w,y+h ) * _mouseScale with
Return New Rectf( x,y,x+w,y+h ) * _mouseScale
results in a fullscreen Monkey canvas in both Zoomed and non-zoomed mode on iPhone 6. YAY!
The reported resolution is still off. Taking a screenshot in Zoomed mode, shows that iPhone correctly goes to 640x1136, but Monkey reports the res as 750 x 1331 (close to the hardware res that is 750x1334)
Screenshot and resolution is fine in non-zoomed mode as both run at 750x1334.
Looking at the code, it seems Monkey (with the above fix) will create a canvas that's 750 x 1331 and scale that to Zoomed iPhone's resolution of 640x1136. That is better than not fitting the screen, but of course not optimal.