eng.GetCanvasWidth() gives wrong dimensions for 4 in iPhone (at least in the simulator)

19 views
Skip to first unread message

RobB

unread,
Jan 14, 2014, 4:40:32 PM1/14/14
to fantom...@googlegroups.com
A small game app uses eng.GetCanvasHeight() to determine the screen size of the device.  It seems to work properly for all the iPad/iPhone hardware types except the 4 in iPhone, which it reports having a width of 640 instead of 1136.  This is in the iOs Simulator, we don't have access to that size of device.

Any help is appreciated.

Here's the relevant bit of code, in case it is simply some typo:




 

'Create an instance of the fantomEngine and store it into the field 'eng'

 eng = New engine

 scrnW = eng.GetCanvasWidth()

 scrnH = eng.GetCanvasHeight()

 If scrnW = 576 And scrnH = 768 '
html test mode

 scale
= 0.75; keyTilt = 1; deviceName = "html test mode"; imFolder = "L/"; sndFolder = "OGG/"; sndType = ".ogg"

 
EndIf

 
If scrnW = 320 And scrnH = 480 'old iPhone

 scale = 1.0; keyTilt = 0; deviceName = "old iPhone"; imFolder = "M/"; sndFolder = "ACC/"; sndType = ".mp4a"

 EndIf

 If scrnW = 640 And scrnH = 960 '
short retina iPhone, iPod Touch

 scale
= 2.0; keyTilt = 0; deviceName = "short retina iPhone or iPod Touch"; imFolder = "M/"; sndFolder = "ACC/"; sndType = ".mp4a"

 
EndIf

 
If scrnW = 1136 And scrnH = 640 'tall retina iPhone

 scale = 2.0; keyTilt = 0; deviceName = "tall retina iPhone"; imFolder = "M/"; sndFolder = "ACC/"; sndType = ".mp4a"

 EndIf

 If scrnW = 768 And scrnH = 1024 '
iPad 1, iPad 2, iPad Mini

 scale
= 1.0; keyTilt = 0; deviceName = "iPad 1, iPad 2, or iPad Mini"; imFolder = "L/"; sndFolder = "ACC/"; sndType = ".mp4a"

 
EndIf

 
If scrnW = 1536 And scrnH = 2048 'iPad 3 retina

 scale = 2.0; keyTilt = 0; deviceName = "iPad 3 retina"; imFolder = "H/"; sndFolder = "ACC/"; sndType = ".mp4a"

 EndIf


Michael Hartlef

unread,
Jan 15, 2014, 12:45:39 AM1/15/14
to fantom...@googlegroups.com
Hi Rob,

I doubt this is a problem with fE. Only if you set the virtual dimension via ftEngine.SetCanvasWidth before, all I do is return there a value that was filled by mojo.GetDeviceWidth().

Are you sure you picked the right Device in the simulator? You have to restart the app after you picked one.

Which Xcode, OSX, Monkey, fantomEngine version are you using?

Cya
Michael

RobB

unread,
Jan 15, 2014, 5:32:52 PM1/15/14
to fantom...@googlegroups.com
Are you sure you picked the right Device in the simulator? You have to restart the app after you picked one.

When i select the 4in iPhone the simulator is taller, with black letter boxing at top and bottom, yes i'm sure.  I'm not sure what you mean by "restarting the app."-- unless it is when you switch to a different device, you are back at the home screen.

Which Xcode, OSX, Monkey, fantomEngine version are you using?

Xcode 5.0.2
OsX 10.8.5
Monkey 76d
Fantom 1.52

Note the code snippet above has the width and hight switched for the 4in iPhone.  I've tried it both ways with the same results, that's just what the code happened to look like when i copied it.

Michael Hartlef

unread,
Jan 16, 2014, 1:38:43 AM1/16/14
to fantom...@googlegroups.com
Ok, I need to install XCode 5.0.2 tonight first. Then  I will use a base script and check if the dimensions are the same like when you call mojo.DeviceWidth() is called alone. It should be but I will see.

RobB

unread,
Jan 16, 2014, 12:53:51 PM1/16/14
to fantom...@googlegroups.com
Thanks for looking into this.

Michael Hartlef

unread,
Jan 18, 2014, 11:30:38 AM1/18/14
to fantom...@googlegroups.com
Hi Rob,

I have tested this and I can confirm the size it reports. But it seems a Monkey/Mojo problem as with even with the FirePaint script from Monkeys examples, it reports these sizes. So there I nothing I can do about this. :-/ Maybe you should report a bug about this?

Regards
Michael
Reply all
Reply to author
Forward
Message has been deleted
0 new messages