Wiley Games on Symbian OS: A Handbook for Mobile Development 978-0-470-99804-5 Benutzerhandbuch

Produktcode
978-0-470-99804-5
Seite von 18
2
Symbian OS Game Basics
Jo Stichbury
2.1 Introduction
This chapter describes some of the basic issues to consider when creating
a game on Symbian OS v9 in C++. We discuss how to write a standard
game loop using an active object timer, how to handle user input from the
keypad and screen, and discuss how to pause the game when interrupted
by a change in application focus. Some of the resource limitations
associated with the mobile platform (such as memory, disk space and
floating point math support) are also discussed.
A sample game skeleton, imaginatively called
Skeleton, which illus-
trates the points discussed, is available for download from
developer.
symbian.com/gamesbook and runs on both UIQ 3 and S60 3rd Edi-
tion emulators and hardware (it was tested on Sony Ericsson M600i,
Motorola Z8, Nokia N73 and E61). The code uses the basic application
framework for each UI platform generated using the New Project wizard
available with Carbide.c++ v1.2. Very little additional UI-specific code
has been added, because the basics described here use generic Symbian
APIs. However, where differences exist between the platforms, they are
described below.
2.2 The Game Loop
Most applications on Symbian OS are driven by user input, directly
or indirectly. For example, the Calendar application displays text as a
user types it, or responds to commands the user submits through the UI
(such as formatting text, or creating and deleting appointments). If the