GLBasic forum

Main forum => GLBasic - en => Topic started by: okee on 2009-Nov-10

Title: How to change to Landscape on iPhone
Post by: okee on 2009-Nov-10
Maybe i'm missing something but is there a command to force the screen
from portrait to landscape mode.
Also is there any way to display a sprite instantly, the minute the app is loaded,
currently the screeen is black for about 4 seconds and then the first screen of
the app is displayed, it's only an app with a few lines of code.
tried a showscreen very early in the program but didn't help


thanks
Title: Re: How to change to Landscape on iPhone
Post by: MrTAToad on 2009-Nov-10
I presume you are talking about the iPhone ?  Is so, you just need to swap the screen resolutions around to change to landscape mode.

You can get an initialising screen to be used while the program loads - take a screenshot of the game and select the appropriate option for it.  Aside from that, there is no real way.
Title: Re: How to change to Landscape on iPhone
Post by: okee on 2009-Nov-10
Yeah, it's set to change the resolution and it works on the pc but not on the iphone.
Actually i'm using setscreen to change, does that work on the iphone?

Title: Re: How to change to Landscape on iPhone
Post by: kaotiklabs on 2009-Nov-10
Try it too in the project properties, under iphone platform.
Title: Re: How to change to Landscape on iPhone
Post by: MrTAToad on 2009-Nov-11
QuoteActually i'm using setscreen to change, does that work on the iphone?
Yes, it does.
Title: Re: How to change to Landscape on iPhone
Post by: matchy on 2009-Nov-11
It should take less less than a second to start an app, not including debugging or image loading.
Title: Re: How to change to Landscape on iPhone
Post by: okee on 2009-Nov-12
Just to explain clearer, I want the start view to be portrait, the user touches the screen
and the next screen appears in landscape, so the user must rotate the phone to view the
screen properly
Do i have to fake the rotation with joystick controls ?

Edit: Actually i'll try it with the fullscreen parameter

Code (glbasic) Select

// Landscape resolution
GLOBAL Lgfx = 480
GLOBAL Lgfy = 320
// Portrait Resolution
GLOBAL Pgfx = 320
GLOBAL Pgfy = 480
SETSCREEN Pgfx,Pgfy,0
SETCURRENTDIR("Media")

LOADSPRITE "bg1.png",0
LOADSPRITE "bg2.png",1
LOADSPRITE "button.png",2

GLOBAL BackImg = 0
CONSTANT GAMEOVER = 0

// Main Loop
WHILE GAMEOVER <> 1
LOCAL sx,sy
LOCAL mx,my,b1,b2
MOUSESTATE mx,my,b1,b2
IF b1 = 1
SETSCREEN Lgfx,Lgfy,0
BackImg = 1
ENDIF
DRAWSPRITE BackImg,0,0
GETSCREENSIZE sx,sy
PRINT "X: " + sx + " Y: " + sy,10,300
SHOWSCREEN

WEND
Title: Re: How to change to Landscape on iPhone
Post by: Kitty Hello on 2009-Nov-12
oh dear. Does that work? I mean... it should, but I'm uncertain.
Title: Re: How to change to Landscape on iPhone
Post by: okee on 2009-Nov-12
The code above doesn't seem to, and i changed it to setscreen Lgfx,Lgfy,1
i wasn't using 1 for fullscreen earlier.
After i do       

SETSCREEN Lgfx,Lgfy,1

the print output shows the sx as 320 and sy as 480

   GETSCREENSIZE sx,sy
   PRINT "X: " + sx + " Y: " + sy,10,300


Title: Re: How to change to Landscape on iPhone
Post by: okee on 2009-Nov-12
Kitty is this a "feature" or an error on my side ?  :)
Title: Re: How to change to Landscape on iPhone
Post by: Kitty Hello on 2009-Nov-13
Very strange. I'll have to see why.