Super Jumper: A 2D OpenGL ES Game 开发详解
1. 游戏屏幕初始化
在游戏屏幕的构造函数中,会对所有成员变量进行初始化。其中, WorldListener 以匿名内部类的形式实现,它会注册到 World 实例中,并根据接收到的事件播放相应的音效。以下是相关代码:
public void hit() {
Assets.playSound(Assets.hitSound);
}
public void coin() {
Assets.playSound(Assets.coinSound);
};
world = new World(worldListener);
renderer = new WorldRenderer(glGraphics, batcher, world);
pauseBounds = new Rectangle(320 - 64, 480 - 64, 64, 64);
resumeBounds = new Rectangle(160 - 96, 240, 192, 36);
quitBounds = new Rectangle(160 - 96, 240 - 36, 192, 36);
lastScore = 0;
scoreString = "score: 0";
2. 游戏屏幕更新
GLScreen.update() 方法是更新的主方法,它会根据游戏屏幕的当前状态调用不同的更新方法。为了避免 Android 1.5 版本中直
超级会员免费看
订阅专栏 解锁全文
20

被折叠的 条评论
为什么被折叠?



