If you have an iPad and you are a developer then you already know that an iPad app must be able to work in
all 4 orientations or at least 2, either in landscape or portrait modes. GLBasic does not do this automatically.
I'm currently using this procedure with my iPad games "Hit the Deck Baseball" and "Just Pong", and works flawlessly
I've included the code below to make your iPad/iPhone app orientate in either landscape or portrait modes.
I'm using OpenGL commands directly, so it is fast. I notice no slow downs in FPS.
To know what orientation the iPad/iPhone is in, use this code:
http://www.glbasic.com/forum/index.php?topic=4650.msg35088#msg35088
NOTE: besides the code below, you must also reverse BOTH X and Y mouse inputs.
Add this code to your main loop:
Add this OpenGL wrapper code to a new file in your project.
EDIT: Found a solution and updated the code.
all 4 orientations or at least 2, either in landscape or portrait modes. GLBasic does not do this automatically.
I'm currently using this procedure with my iPad games "Hit the Deck Baseball" and "Just Pong", and works flawlessly
I've included the code below to make your iPad/iPhone app orientate in either landscape or portrait modes.
I'm using OpenGL commands directly, so it is fast. I notice no slow downs in FPS.
To know what orientation the iPad/iPhone is in, use this code:
http://www.glbasic.com/forum/index.php?topic=4650.msg35088#msg35088
NOTE: besides the code below, you must also reverse BOTH X and Y mouse inputs.
Add this code to your main loop:
Code (glbasic) Select
SETSCREEN 1024, 768, TRUE
LOADBMP background$
FUNCTION upateGraphics:
glPushMatrix()
// use this code to flip 180 landscape (home button on left)
glRotatef(180.0, 0.0, 0.0, 1.0)
glTranslatef(-1024, -768, 0.0) <-- change for iPhone
//use this code to flip 180 portrait (home button on top)
//glRotatef(90.0, 0.0, 0.0, 1.0)
//glTranslatef(-768, -1024, 0.0) <-- change for iPhone
// *** all your DRAW code goes here ***
glPopMatrix()
SHOWSCREEN
ENDFUNCTION
Add this OpenGL wrapper code to a new file in your project.
Code (glbasic) Select
// INLINE functions to use OpenGL functions by Gernot
// directly inside GLBasic
INLINE
#define OGL ::
typedef float GLfloat;
ENDINLINE
INLINE
} extern "C" { void __stdcall glTranslatef( GLfloat x , GLfloat y , GLfloat z );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glTranslatef: x, y, z
INLINE
OGL glTranslatef(x, y, z);
ENDINLINE
ENDFUNCTION
INLINE
} extern "C" { void __stdcall glRotatef( GLfloat angle , GLfloat x , GLfloat y , GLfloat z );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glRotatef: angle, x, y, z
INLINE
OGL glRotatef(angle, x, y, z);
ENDINLINE
ENDFUNCTION
INLINE
} extern "C" { void __stdcall glPushMatrix( void );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glPushMatrix:
INLINE
OGL glPushMatrix();
ENDINLINE
ENDFUNCTION
INLINE
} extern "C" { void __stdcall glPopMatrix( void );; }; namespace __GLBASIC__ {
ENDINLINE
FUNCTION glPopMatrix:
INLINE
OGL glPopMatrix();
ENDINLINE
ENDFUNCTION
EDIT: Found a solution and updated the code.