How to deal with Retina

Previous topic - Next topic

doimus

GETDESKTOPSIZE would be the most useful command on all platforms that have multiple resolutions. I'm all for it.
For example, on "big" platforms, screen resolutions go from 1024x600 (netbooks) up to 2560x1600 or whatever.
Running an 640x480 window on 1920x1080 15" laptop screen is rather crappy experience. Same as running 1280x1024 window on a netbook.

If you want to have decent windowed game, you really need different window sizes for different screens.

Kitty Hello

OK, got it working. The downside is, you can't really switch between highres and lowres.

So far, if you set the project options to 320x480 or vice versa, you get this resolution for safe.
If you set that setting to 640x960 or v.v. you get either that, _or_ 320x480 if it's not supported. You check with GETSCREENSIZE.

I will have to do some tests on the old iPod and iPad before I release an update, but it's looking promising so far. Can't get the device now - kid has it almost under the pillow...

blackway

Hi Gernot,
Can we set the resolution to 1024 x 768 or vice versa (IPAD) and GlBasic scale down to 960x640 or 480x320 if it's not supported? (search for the better resolution that is supported for the device). If you can do that we can build universal binary apps!
What do you think??
Cheers!


Kitty Hello

You can make a universal binary. I'll make an test example and post it.
You have to do the scaling yourself. You can, however, just render to a CREATESCREEN and scale that with STRETCHSPRITE.

blackway

That's great! :good:
Thanks

ampos

Instead of scaling, we (or at elast me) would like to get the highest resolution avaiable, never over the project settings.

So if I set the project settings at 1024x768, with GETSCREENSIZE I want to get the higher, 1024 -> 960 -> 480 to know the real resolution.

If I set it to 480, I always get 480x320...
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

blackway

Hi to all....
I'm thinking about this topic and I don't understand  what's the Gernot's solution!!  :'(
If in project options I set the resolution to 960x640 and the apps run in a older device without Retina Display I will know that using getscreensize? If it's a older device I have to scale the graphics to fit 480x320? If I scale the graphics manually How I handle, for example, mouse coords or touch coords? I must check coords divide by two ? (you know, when you have to check if the player is touching x=700 and y=600 in a device with retina display I have to check if is touching x=350 and y=300 in a older device)
Umm...Hope you understand what I trying to say....



Slydog

#22
Ya, I'm not following it either.

What's the issue of either letting us set the screen size in code (after we determine what device we're running on), or have GLBasic detect it for us and set the screen size automatically to the highest res? 
(But maybe we want the option of not setting the screen to the highest resolution if we find it runs slow on the newer devices, so giving us the freedom to choose would be the best I think, or we don't want to have dynamic code to resize our game layout).

Is it an OpenGL problem?  An internal GLBasic problem?

And like blackway mentioned, with the current solution, how does the mouse (ha finger I guess) coordinates get scaled too?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

The problem is: Maybe you don't _WANT_ to use the full retina for your game. My games usually don't. So, I think there must be a way to define exactly what you want and where.
I'll do a tutorial when I finished testing the iPad. I had a lot to do until this weekend, so that's the reason for the delay.

ampos

Quote from: Kitty Hello on 2010-Dec-20
The problem is: Maybe you don't _WANT_ to use the full retina for your game. My games usually don't. So, I think there must be a way to define exactly what you want and where.
I'll do a tutorial when I finished testing the iPad. I had a lot to do until this weekend, so that's the reason for the delay.

The app should open the biggest screen it can, never bigger than the project screen settings.

Examples:
1.- I am making a Universal App: settings:1024x768. On iPad it would open 1024, on 4G 960 and in 3G/S 480.
2.- I am making a Retina (4G) app: settings at 960x640: on iPad 960 (can it be?), 4G 960 and 3G/S 480.
3.- I am making a "old" app: settings at 480x320. On all idevices it will open a 480 screen.

The programmer has to check at the start of his app the real screen size with GETSCREENSIZE, and load different graphics on resolution or scale them
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello

Right, that's what I'll do.

djtoon

just updated to the new version

so if i set my app for 640x960 il lget retina and in the old phones ill get 320x480 ?
and with getscreensize ill get the size and load sprites to fit it?

is that right?

Kitty Hello


blackway

And what about mouse input?
If I set in project options 960x640 I need to check if the player touch in x=500, y=500 in retina display and x=250, y=250 in old devices or Glbasic handle that automatically?
Thanks Gernot!
Cheers

Slydog

#29
I would hope GLBasic DOESN'T handle the mouse conversion automatically!

If I have to manually position my objects (ie. buttons) depending of the device (which I do prefer, to have full control), my objects know their location and size, so I use those in my Button_IsClick() event handler.  I'm expecting the mouse functions to return the actual mouse pixel coordinates.

Just create a TYPE like this:
Code (glbasic) Select

TYPE TRect
  x%
  y%
  w%
  h%

  FUNCTION Set%: x%, y%, w%, h%
    self.x = x
    self.y = y
    self.w = w
    self.h = h
  ENDFUNCTION

  FUNCTION IsClick%:
     ... handle checking mouse coordinates to see if they are within self.x, self.y, self.w, self.h, RETURN TRUE or FALSE
  ENDFUNCTION

ENDTYPE


Then, you don't need an actual object (or whatever), just declare regions for clicking such as:

Code (glbasic) Select
LOCAL button_fire AS TRect
IF screen_width = 480
  button_fire.Set(10, 10, 50, 50)
ELSEIF screen_width = 960
  button_fire.Set(20, 20, 100, 100)
ENDIF

//Then check if the 'button' area is clicked by:
IF button_fire.IsClick() THEN . . .


Just typed the above by hand, nothing tested of course.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]