I can now place working buttons on the HUD layer - the HUD layer is the same resolution as the screen, so things will look more spaced out on a tablet than on a phone, that's why I had to allow anchoring the buttons to any corner or centre of the screen.
Also, the countdown timer down at the bottom gives more a sense of a game, but so far nothing happens when it reaches 0:00.
Got parallax background layers working. Everything set up from the game level script. In this image there's one "space" 1000x1000 distance units (light-seconds?) backdrop image with a parallax factor of 0.9, meaning it pans at x0.9 the speed of the foreground.
Also there's fire, smoke and sparks coming out of that engine... :-)
I'll soon have to stop adding more stuff in and look at optimising the rendering performance as it's all very raw at the moment and I know there's lots to optimise away.
Ported text rendering in! This uses bitmap fonts generated by BMFont and applies a colour and alpha to it and any transformation. The text below is being rendered to the HUD layer - a top layer that's always there to have UI controls like the joystick, buttons, text.
I ported the Objective C particle emitter sample code by 71 Squared onto C++, used libxml2 to read .pex files and let ParticleEmitter objects be Sprites. So now the Rocket game object has one of those and it works beautifully!
The grey circles that look like lens flares are actually the virtual joystick.
I fixed all the scaling and translating issues I had in the old GL ES1.1 SpaceCab. Everything works perfectly now according to whatever is in the game level script. Also, I'm detecting and working with the retina x2 displays.
In this image:
- the small planets forming a square are 200 distance units apart.
- the square (1000x1000) is the defined game level area.
After much fiddling, I disabled all objects (text, image layers) but the sprites and I can now see the virtual joystick and an animating rocket. Next problems to fix:
- the alpha is not being applied
- the rocket image is sheared at 45º
- it seems to think the resolution is still 320x480
So I deconstructed the whole SpaceTaxi project: started a new project using Xcode's OpenGL ES app wizard and copied most relevant classes over from the old project. This also meant discarding OpenGL ES 1.1 and the fixed pipeline and starting using shaders for everything and a custom matrix and transformations class - with ES 2.0, I had lost all the standard transformation functions (glScale, glTranslate, glRotate), matrix stack management (glPushMatrix, glPopMatrix) and quite a lot more. I still don't know exactly what I can count on being available.
After weeks of part-time tinkering, I turned SpaceTaxi from this:
And that's a good thing! It's a red sprite being rendered on a green background via my own shaders and transformation matrix. Now that I have this set up, on to getting the game back up!
No more iPhone 3G compatibility :-) but on the other hand I now get retina (was stuck with 2x scaling) and all the power of shaders on my hands.