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 2D graphics


Now that we know how to load resources, we can get on with the fun stuff. We're going to look at how we can draw a bitmapped image on screen.

IwGx initialization and termination

We've already seen how to do this in the "Hello World" project of Chapter 1, Getting Started with Marmalade. We just call IwGxInit to set up IwGx at the start of our program and IwGxTerminate to close it down again at the end.

Rendering a polygon

In IwGx, the most commonly used polygon types are lines, triangles, and quads (basically two triangles that share a common edge).

Also supported are sprites, which are always rectangular in shape and do not allow any scaling of textures, and n-polys, which can contain up to 63 vertices.

Sprites are rarely used since triangles and quads are more flexible, though they can be faster to draw especially in software rendering mode. The n-poly can also be faster to draw for the software renderer than a series of triangles, but they are generally best...