GLBasic forum

Main forum => GLBasic - en => Topic started by: Crivens on 2011-Aug-27

Title: Resolutions
Post by: Crivens on 2011-Aug-27
Is there a way to make a device use it's highest resolution settings?

Currently my project resizes graphics based on a comparison made between the used resolution and a target resolution. I am targeting the retina iOS devices so have the project settings of 640x960. On my iPod 4G no resizing is required but my 3GS shrinks them as the resolution is 4x the pixels less. If I set to 320x480 then the retina device does use that resolution. However I would imagine the iPad will do the same thing as this and stay at 640x960. Not what I want. Needs to use full iPad size.

Ok I could do graphics for the largest display and set to that but I would rather have an option where all devices just use their native resolutions and I can worry about the resizing myself and not worry about setting to the highest resolution setting when things may change in the future.

Cheers
Title: Re: Resolutions
Post by: FutureCow on 2011-Aug-28
Isn't the GETDESKTOPSIZE command what you're looking for? Based on what it returns you can choose different resolution graphics to display.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-28
I need it mainly for mobile devices and with these they set the resolution set in project settings otherwise if it can't do that you get the native resolution.

So if you set resolution in project settings to 640x960 then a 3GS would be 320x480 and an iphone4 would be 480x960. Great. But an iPad would be 480x960. If I set to iPad resolution then it would work for all but what if greater resolution in future? Ideally just a setting that says get native resolution would be brilliant (or custom so can say 9999x9999).

Cheers
Title: Re: Resolutions
Post by: Kitty Hello on 2011-Aug-29
The problem is, that the resolution must be set before the GLBasic main() kicks in. And there's no way to change it afterwards :(

So, take it as it is, and with newer devices (pleaaaase NOOOO) we'll see how to deal with them. Maybe an checkbox option or so.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-29
But it seems that if the native resolution is lower than the project settings then it sets it at the native resolution. If lower then if it can it sets it at the lower resolution. Eg if set to 320x480 then a retina display will show at 320x480.

If that is true then can't you have a native option that basically tries to do something like 9999x9999? Obviously that is higher than anything so it just uses the native resolution of the device.

Cheers
Title: Re: Resolutions
Post by: Kitty Hello on 2011-Aug-29
yes. put 1024x768 and you can support iPad, Retina and 3.1 devices.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-29
Yeah but what would happen when a new device comes out? Would need to then recompile and submit when GLB updated.

Internally does it say I'll try the project settings and if that fails use native? If so then all I'm saying is have an option in project settings that says skip the first check (or at least try sonething stupid like 9999x9999) and just use native. No worries about recompiles then or waiting for GLB to be updated if we handle the resolution ourselves.

Cheers
Title: Re: Resolutions
Post by: Kitty Hello on 2011-Aug-29
yes. Try 9999x8888 - to ensure you want landscape and 8888x9999 for forced portrait.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-29
Ang on, are you saying there is a custom option in project settings? That would work great

Cheers
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-30
QuoteTry 9999x8888 - to ensure you want landscape and 8888x9999 for forced portrait
Where do I set this in the project settings? Or are you saying use the setscreen command (and just leave the project as any old thing)? If so I thought you said to not use it on mobile devices with set resolutions?

Cheers
Title: Re: Resolutions
Post by: ampos on 2011-Aug-30
Crivens, you can just type the number on the box.

Title: Re: Resolutions
Post by: Crivens on 2011-Aug-31
I can? What in the drop down of project options?

Cheers
Title: Re: Resolutions
Post by: ampos on 2011-Aug-31
Yeah, just type "8000x9000" on the resolution box.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-31
Cool. Is not totally obvious. Will try tomorrow. Out of interest is the device dropdown in project settings just there for resolutions? So I could set to iPhone and 9998x9999 and still use that for WebOS compilation or Android? There isn't anything else it does?

Cheers
Title: Re: Resolutions
Post by: ampos on 2011-Aug-31
Yes, you are right. I think this drop down menu is just a "resolution presets". You can overide them by typing.

Notice that in windows it will really will open a window this size! (not sure about full-screen)
Title: Re: Resolutions
Post by: doimus on 2011-Aug-31
What does GETDESKTOPSIZE return in case of these 8000x9000 workarounds? Does it return actual device res like 1024, 960, 480?
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-31
If it's like my existing code then it tries to use the resolution in project settings and then goto native if it fails. So setup retina and a 3GS will switch to non-retina but a 4 will do retina. Use the command to retrieve the screen size if not PC otherwise set the screen size to what you want for a pc. Easy.

Cheers
Title: Re: Resolutions
Post by: ampos on 2011-Aug-31
Quote from: doimus on 2011-Aug-31
What does GETDESKTOPSIZE return in case of these 8000x9000 workarounds? Does it return actual device res like 1024, 960, 480?

GLB will try to open the highest resolution upto the one in the settings.

Example: on iOS you set max as 960x640 (retina). If you run it on iPads (768x1024) it will be 960x640. On 3G it will be 320x480.

getdesktopsize returns the size of the desktop, not the openen one.

If you want to know the real resolution your app is using you have to use getscreensize instead.

Title: Re: Resolutions
Post by: Kitty Hello on 2011-Aug-31
getdesktopsize returns the physical pixels of the display device. 320x480 for 3Gs, 1024x768 for iPad.
Title: Re: Resolutions
Post by: Crivens on 2011-Aug-31
Excellent. Will try it when I get the chance. I still think though that the project settings isn't very obvious to allow you to over type the resolutions and should be changed to be clearer.

Cheers
Title: Re: Resolutions
Post by: Nathan on 2011-Sep-15
Just to hijack this thread with a screen resolution question.  In the Project -> Options dialog I have Platform configuration set to iPhone, with the resolution drop down I've chosen of 960x640.
However, when I compile and run my program, the window size, as given by GETSCREENSIZE is 1024,768.  Should it not create a window that has dimensions of 960x640?  (Or whatever is chosen in the options screen)
I know I can use SETSCREEN to change the resolution, but I believe this shouldn't be used for iDevices?
Title: Re: Resolutions
Post by: Kitty Hello on 2011-Sep-16
1024x768? Are you running it on an iPad?
Title: Re: Resolutions
Post by: Nathan on 2011-Sep-16
Nope, at the moment I'm doing everything on my Windows PC.
And I've just tried this at work (ahem), with the free non-registered version, at home my version is registered, but I don't think it's behaving any differently.  But please let me know where I'm going wrong...

- In the Project Options, set the Platform to Win32 and any resolution, e.g. 176x220.
- Compile and run, GETSCREENSIZE correctly shows 176x220.
- In the Project Options, change the Platform to iPhone and leave it at the default res that is given, i.e. 320x480.
- Compile and run.  GETSCREENSIZE shows the previous res of 176x220.

No one else has mentioned this so it must be something I'm doing?
Title: Re: Resolutions
Post by: ampos on 2011-Sep-16
This is the resolution you will get IF compiled for iPhone. If you want to test iPhone resolution on your development machine (aka windows/win32) yo have to set the screen size in the project menu for Windows/win32.

So, change your resolution from 176x220 to 320x480 onm the Win32 platform settings.
Title: Re: Resolutions
Post by: Nathan on 2011-Sep-16
Ahhh, I see, thanks for that Ampos.
Yeah, my intention is to do a majority of the progam development on Win32, then only compile and transfer it to Apple devices towards the end.