Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - Millerszone

#41
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:
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.
#42
Using this command batHitBall = ANIMCOLL(ball,0, ballX, ballY, bat, batAnim, batX, batY) I get about
a 1/2 second stutter of the ball when I swing the bat, but it only happens with the first pitch and
on a slow computer. After the first pitch it works fine, smooth and on my quad PC the ball never stutters.

I even tried putting ANIMCOLL(ball,0, ballX, ballY, bat, batAnim, batX, batY) in the main loop and still
the same thing.

Any help would be appreciated.

Mike
#43
If you add Default.png to the "resources group folder" in Xcode, the the splash-screen
only stays for a split second. If you don't add the default then it takes several seconds
to display a splash-screen. Sure you can use the Default.png and then loadbmp of
the same image as the default, but that doesn't look to good. :whip:

Is there some delay switch we can set for the Default.png?

#44
I have an animated image that has 21 frames and the size of each frame is 229x228.
So my png image strip is 4809x228. I believe the iPad has a limit of 2048x2048.

My question, is the iPad limit for the animated image strip(4809) or each frame?
Will I have to break it down to 3 lines?

I will be using LOADANIM, DRAWANIM and ANIMCOLL.

Is there a faster solution than using the above commands?

Thank you, Mike




#45
I use "SLEEP 1000" to pause my game after the player scores, but after pause
the score has changed when returning to the game. Like the game is still running
in the background.

If this helps, I use the GETTIMER() for my movements.

Appreciate any help,
Mike
#46
I'm working on a pinball type game. With "Game Maker" you had commands
like "Speed, Direction, Friction, Gravity, Etc...".
I'm having trouble with "Direction" of the ball in GLBasic.
The more the angle/direction the ball moves, the faster it moves. I would like
the ball to stay the same speed, unless I command the ball to move faster or slower.

I would appreciate if someone could show me an example of the commands above
converted to GLBasic. I'm sure it's very easy for most.

Thank you.
#47
The problem that I am having is that the ball and paddles are some times slightly "jumpy", not smooth.
You can exit the game and it might run smooth again, exit and it might be jumpy again.
I ran the game on several computers(3.5Ghz, quad) and a laptop(1.5Ghz) which have Windows 7/Windows XP, but they all do
the same thing, sometimes smooth, sometimes jumpy.

You can see what I'm talking about by downloading my game in the GLBasic Beta Test forum:
GLBasic Test Forum "JustPong"

Thank you, Mike
#48
Coming from "Game Maker" there was a editor called "Rooms" where you layout
your objects(sprites) for your game levels.

Is there some kind of simple editor that works with GLBasic where you just load a
background and some objects and it'll give you the x,y positions? I know there are
tile map editor's (which I couldn't a 800x600 background to load).

The way I do it now is set my object x,y position as close as possible to the position
I want, run the game, if it's not where I want it, I will we position and so on.

Thanks,
Novak

#49
I know I need the $99 Apple developers license to sell my app through iTunes. My question is, can I test my iPad app on the device without the Apple license?

I already have GLBasic SDK premium license.

Thank you,
Novak
#50
When ball reaches high speeds (28+) it goes through the paddles. I tried both SPRCOLL and BOXCOL.
Are there any solutions besides making the paddle wider? or will a wider mask sprite of a paddle help?

Also, when the ball hits the very top or bottom back edge of the paddle, the ball goes inside the paddle
and moves through the paddle about half way and then comes out.

Here is the code for collision...

Code (glbasic) Select

// Ball and left paddle collision routine
      IF BOXCOLL(rpaddle_x, rpaddle_y, 14, 80, ball_x, ball_y, 14, 14)


Thank you.
#51
Since I am new to GLBasic I am going to make a pong game to get familiar with GLBasic.
The only other "Programming" experience I had was with "Game Maker".

Question: My pong background picture is 800x600. My computer HD monitor is set to 1360x768.
The problem I'm having is when in full-screen the background picture stretches, not 1:1 ratio.
I would like to keep the ratio 1:1 (800x600) when in "Full Screen" at any screen resolutions.
Windows mode keeps the 1:1 ratio.

I searched the forum but I could not find any fixes.

I would appreciate any help.
Registered GLBasic User,
Novak