Changing from Portrait to Landscape

Previous topic - Next topic

ggindlesperger

If I missed this in another post I apologogize. I searched through and did not see anything on this, but I did not look at all the posts the search brought up either. My game is starting in portrait mode. Is there away to switch during the game to lanscape? I want level 2 of the game to play different then level 1. I know I can do it by rotating sprites and such, but just wondered if there is an easier way.

Thanks so much for any info.

backslider

Maybe you can use the SETSCREEN command in a function and set the width=480 and the height=320?!

greets

ggindlesperger

Thanks for the suggestion..I tried that and I got weird results.  I should have put that in my original post that I tried that.

ggindlesperger

I was thinking this is not so much an issue because I can rotate things, but then I have the problem of any text I display with a print command. The problem would mainly be with printing the value of variable. It will still want to print them in portrait view. If somene can tell me of away to rotate the text that would solve the problem. Keep in mind I want this for the iPhone so I guess I can not use grabsprite to make the text a sprite and rotate it.

Thanks in advance.

backslider

U could rotate each character of your font bitmap around 90 degrees?!  =D
OK it´s not a good solution^^

ggindlesperger

Well in the end I figured out that my plan to use the one level in landscape did not work out well anyway so I am just sticking with portrait. Thanks for the suggestions.

okee

I asked a few months ago, from Kittys response it's supposed to work
although i haven't tried doing it since.

http://www.glbasic.com/forum/index.php?topic=3793.0
Android: Samsung Galaxy S2 -  ZTE Blade (Orange San Francisco) - Ainol Novo 7 Aurora 2
IOS: 2 x Ipod Touch (1G)

ggindlesperger

I more or less did the same thing you did with the same results. Using setscreen kind of split my screen in a goofy way. What I wanted to do with it ended up not working out anyway so I stayed portrait. I know folks mentioned changing the project settings to landscape, but that seems to me to be a setting to effect the whole project and not really have anything to do with switching during the program.

Slydog

It would be a nice feature to rotate the screen dynamically.
You could add a nice touch to your game by automatically rotating the screen based on the iPhone rotation.
(ie. no matter how much you rotate, the game snaps to the best rotation so your game always appears upright).
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

Render to an offscreen surface (CREATESCREEN/USESCREEN) and draw that sprite with DRAWSPRITE and my "getrotation" function later. It's about .. 5 lines for you.

matchy

From your CREATESCREEN sprite, poly draw it at any angle!  :D

Code (glbasic) Select

FUNCTION funPolyAngleDraw: pts[],iX,iY, iSprite,iAngle
LOCAL iPnt,iPnts,iX1,iY1,iX2,iY2,iLX,iLY

iPnts=BOUNDS(pts[],0)-1
STARTPOLY iSprite
FOR iPnt=0 TO iPnts
iX2= (COS(iAngle)*pts[iPnt][0])+(SIN(iAngle)*pts[iPnt][1])
iY2=-(SIN(iAngle)*pts[iPnt][0])+(COS(iAngle)*pts[iPnt][1])
iX1=iX+iX2
iY1=iY+iY2
POLYVECTOR iX1,iY1,pts[iPnt][2],pts[iPnt][3],pts[iPnt][4]
NEXT
ENDPOLY
ENDFUNCTION

Kitty Hello

a Drawsprite might be faster than a 4 noded polyvector. I use a faster SIN internally. The polyvector outperforms drawsprite only if you draw a lot of strips in one batch.

matchy

How do you mean by rotating with DRAWSPRITE? ROTOSPRITE is slower that POLYVECTOR.

Kitty Hello

No. Rotosprite is faster - if you only draw _one_ sprite. The speed of POLYVECTOR comes from when you draw a lot of quads in one glDrawArrays (ENDPOLY) call. Thus, using POLYNEWSTRIP speeds up drawing tiles and such a lot.

matchy

In regards to rotating one full screen I did fps test and there doesn't seem to be a difference now since recent updates. 32-45 fps for 1024x1024 on iPad. :P