Hi.
I have a game I am writing that has platform conditional code. It has been a real learning example but I finally have it working from one source code and one set of graphics.
I use Ampos's generous rescaling code mainly, slightly customised to my needs. Thanks Ampos!
My game runs and has been tested on PC, Mac, iPhone 3, iPhone 4s, iPad 1, iPad 2, iPad 3rd Generation and iPod.
I designed the game initially at 1024x768 (4:3 aspect ratio resolution) for all my graphics and screen placement code and use Ampos's routines to rescale to chosen resolution.
Ok.
So.. on the PC platform - I set project settings to be 3999x3998 manually and the code autoscales by reading the DESKTOP size and setscreen'ing to that resolution. Works great.
I have a 27" iMac here and run GLBasic on Parallels fullscreen mode - the desktop size is 2560x1440 on this computer and the game works out the scale factor internally and fills the screen to the games 4:3 aspect ratio.
Works as expected. Graphics are very crisp as I have an 8 bit style and don't use Smoothscale modes on the whole.
On iOS - I designed the game for my main platform at the time - the iPad 1 and iPad 2 at 1024x768. Again I set the project settings to 3999x3998 and the code reads the SCREENSIZE this time (using conditional code) and resizes.
When compiling on Xcode, I set project type to universal.
This means it runs on iPad at 1024x768. It run on new iPad 3rd gen model at 2048x1536 (upscaling by a factor of 2.0). Due to the 8 bit nature of my graphics it looks great on the new iPad2 (I use smoothshading off to get the effect I need).
It autosizes on the fly on iPhone to 960x480, again running in a 4:3 aspect ratio scaled area. Great! iPhone 3 - same it runs at 480x240 with no issues. IPod Same.
The one problem is the Mac platform. Here is why. You can't use the SETSCREEN command I have found, as it causes crashes and bad things to happen so I have to rely on project settings here.
If I set project settings to 1024x768 on the Mac - the game runs fine as it sets my macs monitor to 1024x768 graphics mode automatically on startup. Looks a bit blurry though as the native monitor resolution is 2560x1440. It runs on my Macbook at 1024x768 again fine. (The Macbook native res is 1280x800).
Now then.. If I manually set the project settings for Mac to 2560x1440 - it runs on my Mac at native resolution now at 2560x1440 and the graphics look as crisp as they do on Parallels under windows mentioned earlier.
The problem is.. If I run this binary on my Macbook - the native screen size is 1280x800. What happens is the binary crashes at launch - not good.
If I compile another version with project settings at 1024x768 it runs fine of course.
*I see Macbook Air screen resolutions all support 1024x768 4:3 modes, but are native 1366x768 for 11.6" models and 1440x900 for 13" models.
The point of all this is .. I have a proposal to make.. that to my mind would improve the way things can be handled on the Mac platform.
Here it is..
On Mac - you have to rely on Project settings - thats fine.
I can set 1024x768 or manually enter in 2560x1440 but both these things cause the problem above when Mac screen hardware is different sizes (ie. crashes on startup).
What if.. On the Mac if you could enter 3999x3998 manually as project settings. This would then be a flag to the GLBasic Mac runtime startup code that it should see what the native Mac screen resolution is and (without resizing) it should use those values for the current screen size - if the users program requests to know the SCREENSIZE, it should return those native screen resolution numbers. That way AMPOS's code could resize as normal.
That would mean that if I set project settings manually to 3999x3998, the game would run at 2560x1440 on my 27" iMac and at 1280x800 on my Macbook as those are the native screen sizes. This would just need one binary and it would not crash at startup on my Macbook (instead of what it does at present).
This change would require runtime startup support from GLBasic of course - to my mind it makes sense at it is a special case (3999x3998 manually) but would allow more flexibility on the Mac platform..
What do you think Gernot?
I have no idea if these changes are easy/impossible/make sense but as I say, to me in theory they do.
You could either hard set the resolution to use in Mac project settings to say 1024x768 or allow manual special case size of 3999x3998.
Thanks.