我正在尝试创建一个包含一些菜单项的游戏菜单,例如
- 新游戏
- 多人游戏
- 选项
- 出口
我想让这个菜单项透明。只有白色文本应该可见。
所以我想我不需要菜单项的任何背景图像。
我看过下面给出的 SpriteButton 示例。
ButtonSprite playButton = new ButtonSprite(0, 0, btnNormalTextureRegion, btnPushedTextureRegion, this.getVertexBufferObjectManager(), new OnClickListener() {
@Override
public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
// Do Stuff here
}
}
我不明白的是如何初始化btnNormalTextureRegion?
我使用下面给出的代码来初始化对象的 ITexture 和 ITextureRegion。
mBackgruondTexture = new BitmapTexture(activity.getTextureManager(), new IInputStreamOpener() {
public InputStream open() throws IOException {
return activity.getAssets().open("gfx/backgrounds/greenbg.jpg");
}
});
mBackgruondTextureRegion = TextureRegionFactory.extractFromTexture(mBackgruondTexture);
此代码从asset 打开一个图像。
因为我不想为菜单项使用任何图像我如何初始化btnNormalTextureRegion。
或者
有没有其他方法可以创建游戏菜单?