Book Image

Marmalade SDK Mobile Game Development Essentials

By : Sean Scaplehorn
Book Image

Marmalade SDK Mobile Game Development Essentials

By: Sean Scaplehorn

Overview of this book

Modern mobile devices are capable of supporting video games of amazing quality but there are so many different devices and platforms how can you support them all? The answer is to use the Marmalade SDK to write your code once and deploy it to all popular mobile platforms at the touch of a button.Marmalade SDK Mobile Game Development Essentials will provide you with everything you need to know to transfer your existing C++ videogame programming knowledge to mobile devices. From graphics and sound to input methods and actual deployment to device, this book covers the lot.Learn how to make use of keys, touch screen and accelerometer inputs for controlling your game.Take the pain out of supporting a varied range of target devices, both across multiple platforms and multiple specifications.Step by step from "Hello World" to a complete game, this book will show how to use the Marmalade SDK to develop games for mobile devices.Learn how to make dazzling 2D and 3D games complete with fully animated characters, music and sound effects that can be deployed to all the leading mobile platforms, whilst ensuring it can run on a wide range of possible devices, from low specification to high end.If you want to join the exciting world of mobile videogames then Learning Mobile Game Development with Marmalade will show you how to do so, fast!
Table of Contents (17 chapters)
Marmalade SDK Mobile Game Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using IwGx to render 3D graphics


Remember when we were looking at 2D graphics rendering in Chapter 2, Resource Management and 2D Graphics Rendering, I said we would be using IwGx because it would make the transition to rendering 3D graphics that much easier. Now's the time to see if my claim was true!

In this section, we shall look at how we can implement the 3D equivalent of the "Hello World" program—a spinning cube.

Preparing IwGx for 3D rendering

As with 2D rendering, the very first thing we need to do is initialize the IwGx API by calling IwGxInit, and of course we should call IwGxTerminate at the end of our program.

With IwGx ready to go we next need to set up our projection. We're going to be using a perspective projection, so we need to be able to specify the perspective multiplier value that we want to use. The code to do this is as follows:

IwGxSetPerspMul((float) IwGxGetScreenWidth() * 0.5f);

This line of code sets the perspective multiplier up, to provide a 90 degree field of view...