P.325において一カ所関数の引数が多い箇所がありましたので、訂正いたします。
誤:
drawTyreBarrier(currentGame.tyreBarriers[i]->radius, 0.03f,
tyreTexture, tyreSideTexture);
正:
drawTyreBarrier(currentGame.tyreBarriers[i]->radius, 0.03f, tyreTexture);
P.325において一カ所関数の引数が多い箇所がありましたので、訂正いたします。
誤:
drawTyreBarrier(currentGame.tyreBarriers[i]->radius, 0.03f,
tyreTexture, tyreSideTexture);
正:
drawTyreBarrier(currentGame.tyreBarriers[i]->radius, 0.03f, tyreTexture);
P.294におけるタイヤバリアの描画部分において、一カ所引数の順番が間違っている箇所があったため訂正いたします。
ES1Renderer.mm
誤:
drawCircle(currentGame.tyreBarrier[i]->center,
currentGame.tyreBarrier[i]->radius, 8, 255, 255, 255, 255);
正:
drawCircle(currentGame.tyreBarrier[i]->center,
8, currentGame.tyreBarrier[i]->radius, 255, 255, 255, 255);
P.290において一部不要な表記があったため、お詫びして訂正いたします。
P.290 5-7-2 外枠との衝突
誤:
- (void)update{
// ラップタイムを計測します
currentLapTime = (int)floor(-[currentLapStartTime timeIntervalSinceNow]); ... ←この部分を修正
正:本来この部分の修正は必要ありません
- (void)update{
// ラップタイムを計測します
currentLapTime = -[currentLapStartTime timeIntervalSinceNow];
P.265においてVector2D.hをインポートするべき箇所で、ソースコード上の表記が一部間違っていたため訂正いたします。
誤:
#import "ector2D.h"
正:
#import "Vector2D.h"
P.247とP.249掲載のソースコードにおいて、不要な括弧が含まれている箇所がありました。お詫びして訂正いたします。
P.247 ES1Renderer.mm
誤:
int currentLapTimeMilliSeconds =
(int)floor((currentGame.currentLapTime * 1000.0f) % 1000;
正:
int currentLapTimeMilliSeconds =
(int)floor(currentGame.currentLapTime * 1000.0f) % 1000;
P.249 ES1Renderer.mm
誤:
int currentLapTimeMilliSeconds =
(int)floor((currentGame.fastestLapTime * 1000.0f) % 1000;
正:
int currentLapTimeMilliSeconds =
(int)floor(currentGame.fastestLapTime * 1000.0f) % 1000;
id: namutakaさんがブログで指摘してくださいましたが、第2章のテクスチャ読み込み部分において確保したメモリ領域をクリアする処理が抜けておりました。お詫びして訂正いたします。
P.57 graphicUtil.mm の中において
GLubyte* imageData = (GLubyte *) malloc(width * height * 4);
memset(imageData, 0, width * height * 4);
テクスチャの読み込み用に確保したメモリ領域をゼロでクリアする二行目のコードを追加してください。
id: namutakaさん、ご指摘ありがとうございました。
iPhone SDK 3.2においてXcodeで生成されるプロジェクトのソースコードは、本書(iPhone SDK 3.1.x用)で説明しているソースコードと若干異なります。
iPhone SDK 3.2を使用して読み進める場合は、以下の点に注意してください。
P.10

3.1.xではアプリケーションの起動直後呼ばれるメソッドとして
- (void) applicationDidFinishLaunching:(UIApplication *)application
が用意されますが、3.2では
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
が用意されます。
本書でapplicationDidFinishLaunching内に記述している処理は、3.2系ではapplication:didFinishLaunchingWithOptionsの中に記述してください。
202ページ内のランドスケープモード設定に関するソースコードの式が一部誤っていたため、お詫びして訂正いたします。
誤:
...略...
glView.transform = CGAffineTransformConcat(glView.transform, CGAffineTransformMakeRotation(M_PI * 90.0f / 180.0f);
...略...
正:(最後のとじ括弧「)」が抜けていました)
...略...
glView.transform = CGAffineTransformConcat(glView.transform, CGAffineTransformMakeRotation(M_PI * 90.0f / 180.0f));
...略...
164ページ内のソースコードが一部誤ったものが掲載されてしまったため、お詫びして訂正いたします。
誤:
...略...
bgm = [[AVAudioPlayer alloc] initWithContentsOfURL:bgmFileUrl
error:nil];
bgm[setNumberOfLoops:-1];
bgm[play];
...略...
正:
...略...
bgmSound = [[AVAudioPlayer alloc] initWithContentsOfURL:bgmFileUrl
error:nil];
[bgmSound setNumberOfLoops:-1];
[bgmSound play];
...略...
186ページ内のフェードインに関するソースコードの式が一部誤っていたため、お詫びして訂正いたします。
誤:
...略...
//フェードアウトします
alpha = 255 - (int)round(lifePercentage * 2.0f * 255.0f);
...略...
正:
...略...
//フェードアウトします
alpha = 255 - (int)round((lifePercentage - 0.5f) * 2.0f * 255.0f);
...略...