1
\$\begingroup\$

I'm trying to create a Game Menu which contains some Menu Items like

  1. New Game
  2. Multiplayer
  3. Options
  4. Exit

I want to make this Menu Items Transparent. Only Text in White color should be visible.
So i guess i do not need any background image for Menu Items.

I have seen examples of SpriteButton like given below.

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
     }
}

The thing which i don't understand is how can i initialize btnNormalTextureRegion?
I use the code give below to initialize ITexture and ITextureRegion for objects.

mBackgruondTexture = new BitmapTexture(activity.getTextureManager(), new IInputStreamOpener() {
                public InputStream open() throws IOException {
                    return activity.getAssets().open("gfx/backgrounds/greenbg.jpg");                
                }
            });
mBackgruondTextureRegion = TextureRegionFactory.extractFromTexture(mBackgruondTexture);

This code openes up an Image from assest.
As i do not want to use any image for Menu Item How can i initialize btnNormalTextureRegion for SpriteButton.

OR

Is there any alternative to create Game Menu?

\$\endgroup\$
1

1 Answer 1

1
\$\begingroup\$

You can always use the power of Android activites and UI widget to create the Main menu. Here is what you can do :

  1. Create an Activity and have this intent filter for it :

    <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>

  2. On this activity have all the menu options you have mentioned. This means create a xml with the design as you want it to be. Also keep it full screen.
  3. On 'New Game' click (keep it Button or ImageButton), start the GameActivity which you might have extended from SimpleBaseGameActivity, SimpleLayoutGameActivity etc. Use intent.startActivity(/**context**/,/**gameActivity class**/)

Remember that the game activity you create using andengine is just another Activity. You will just have to take care of the activity life cycles. This is because the AndEngine game activity will be holding the SurfaceView. Let me know if you need detailed help.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .