Author Topic: How to deal with Retina  (Read 7180 times)

Offline Leginus

  • Dr. Type
  • ****
  • Posts: 288
    • View Profile
Re: How to deal with Retina
« Reply #30 on: 2010-Dec-21 »
Now why didn't i think of that.  :noggin:
Nice one!

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1594
    • View Profile
    • AMpostata Website
Re: How to deal with Retina
« Reply #31 on: 2010-Dec-21 »
Even easier...

Code: GLBasic [Select]
If screen=480 then ratio=1   //just once at the start of the program
if screen=960 then ratio=2
if screen=1024 then ratio=2.1333

button n,x*ratio,y*ratio,witdh*ratio,height*ratio
 

That's how I programmed my game KRAKOUT, that support all resolutions, 320x240, 480x320, 640x480, 960x480 & 1024,768

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

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: How to deal with Retina
« Reply #32 on: 2010-Dec-21 »
The iPad's X-Ratio is 2.1333 (1024 / 480), but the iPad's Y-Ratio is 2.4 (768 / 320).
So, you would need two ratios, one for x, and one for y.

The iPad has a different aspect ratio so using my method allows you to customize the layout for that display.

But, ya, that should work fine, if you want the objects displayed in exact proportion and position on each device, your way would sure make things simpler!
« Last Edit: 2010-Dec-21 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline Leginus

  • Dr. Type
  • ****
  • Posts: 288
    • View Profile
Re: How to deal with Retina
« Reply #33 on: 2010-Dec-21 »
Or even easier.....

BumbleBomber 59p
BumbleBomber HD 59p
BumbleBomber for Ipad  59p
 :D

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: How to deal with Retina
« Reply #34 on: 2010-Dec-21 »
Ha, took me a second to realize what 59p was (I was thinking 59 frames a second, progressive!).
That would be currency right?!  (I'm from Canada!  We use 'b' for beaver pelts!  :whistle:)

But ya, 3 separate apps, then you can control pricing and features, but for development you could use the same GLBasic project and just use the following in an 'Initializing' module (and comment / uncomment the appropriate ?DEFINE for the platform you are compiling for):
Code: GLBasic [Select]
?DEFINE TARGET_IPHONE
//?DEFINE TARGET_IPHONE4
//?DEFINE TARGET_IPAD

?IFDEF TARGET_IPHONE
... IPhone specific code, layout, etc
?ENDIF

?IFDEF TARGET_IPHONE4
... IPhone 4 (retina) specific code, layout, etc
?ENDIF

?IFDEF TARGET_IPAD
... IPad specific code, layout, etc
?ENDIF
« Last Edit: 2010-Dec-21 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: How to deal with Retina
« Reply #35 on: 2011-Jan-10 »
So sorry - I really try to fix that bug quickly.

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: How to deal with Retina
« Reply #36 on: 2011-Feb-15 »
God! deal with mouse coordinates on iphone is a nightmare! Is it really as harder as it seems handle this issue in a global way? I mean, doing GLbasic the 'automatic coordinates traslation process?
There is a matter I still don't understand at all: What it is supposed to be the default Glbasic coordinates? I guess it is something to be known as it is a need in order to apply ratios to reach each screen? right?
Someone can help me a little with this issue? I'm lost since I've compiled my game in xcode and the coordinates detection is absolutely weird!
regards!

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1594
    • View Profile
    • AMpostata Website
Re: How to deal with Retina
« Reply #37 on: 2011-Feb-16 »
On my (horizontal) iPhone game I have this:

Code: GLBasic [Select]
        SETACTIVEMOUSE 0
        MOUSESTATE mx1,my1,b11,b21

        ?IFDEF IPHONE
                SETACTIVEMOUSE 1
                MOUSESTATE mx2,my2,b12,b22
                SETACTIVEMOUSE 0
                IF retina=true
                        my2=(my2-320)*2
                        mx2=mx2*2
                        my1=(my1-320)*2
                        mx1=mx1*2
                ENDIF
        ?ENDIF
 

I have not tested if it is fixed in GLB 9...
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: How to deal with Retina
« Reply #38 on: 2011-Feb-16 »
I'll have to check that out. Weekend, OK?

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: How to deal with Retina
« Reply #39 on: 2011-Feb-16 »

Ampos: Thanks a lot for sharing ;) mil gracias por la info! I'll check it out and let you know..

Kitty Hello: Thanks a lot as well, I hope don't bother you but I'm pretty sure the whole GLbasic community will be very pleased if there exist an update to fix this strange x,y mouse/touch conversion as it is very uncomfortable. Thanks a lot in advance, honestly.

best,

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1594
    • View Profile
    • AMpostata Website
Re: How to deal with Retina
« Reply #40 on: 2011-Mar-08 »
Don't know when, but now it is fixed the iPhone 4 mouse/coordinates thing
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