Game Development Reference
In-Depth Information
Figure 3-7.
Project files for the Project Sample 03
The project files shown in Figure
3-7
follows the same pattern as the project from Chapter 2. There
are the shared classes under the group
Sample 03
, while device-specific classes are stored under
the groups iPhone and iPad. The class
Sample_03AppDelegate
contains the initialization code for the
application and code for saving the user state when a player exits the application. The XIB files are
also wired up very much like the XIB files from Chapter 2: the XIB files starting with
MainWindow
each
contain a
GameController
of the appropriate subclass. The class
GameController
contains all of the
logic for managing the state of the application, while the XIB files for each subclass contain the UI
elements suitable for each device.
The class
CoinsController
describes the fun part of the game and the class
CoinGame
is a model
class that describes which type of coins are where, and also the current score and remaining turns.
By archiving an object of the class
CoinGame
, we can save the state of the current game when the
application quits.
The class
HighscoreController
manages the High Score view and displays the data found in the
class
Highscores
. The class
Highscores
contains an array of
Score
objects, where each
Score
object