Our first task at hand is to build the pool table. We will start by looking at our definitions, because we will be using these extensively throughout this chapter:
// Audio definitions #define SND_BUTTON @"button.caf" // Box2D definition #define PTM_RATIO 32 // Define the pocket's tag #define kPocket 500 typedef enum { kBallNone = -1, kBallCue = 0, kBallOne, kBallTwo, kBallThree, kBallFour, kBallFive, kBallSix, kBallSeven, kBallEight, kBallNine, kBallTen, kBallEleven, kBallTwelve, kBallThirteen, kBallFourteen, kBallFifteen } BallID; typedef enum { kRackTriangle = 50, kRackDiamond, kRackFailed } RackLayoutType; typedef enum { kStripes = 100, kSolids, kOrdered, kStripesVsSolids, kNone } GameMode;
You should be familiar with typedef
enum
statements
by now. We create the BallID
type to represent the numbered balls for simplicity. To be able...