0

次のようなメニュー項目を含むゲームメニューを作成しようとしています。

  1. 新しいゲーム
  2. マルチプレイヤー
  3. オプション
  4. 出口

このメニュー項目を透明にしたい。白い色のテキストのみが表示されます。
だから私はメニュー項目の背景画像は必要ないと思います。

以下に示すような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);

このコードは、assestから画像を開きます。
メニュー項目に画像を使用したくないので、SpriteButtonのbtnNormalTextureRegionを初期化するにはどうすればよいですか。

また

Is there any alternative to create Game Menu?

4

1 に答える 1

2

In my opinion, an easier alternative would be creating a scene with Text objects for each menu item. That's the approach I'm using in one of my game. I uploaded the class to pastebin, see it here.

Unless you want the menu items to be sprites themselves (That is, pictures and not just plain text) this is a great way to implement a menu.

于 2012-11-18T20:22:24.177 に答える