Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
You question isn't clear, you question seems to ask too many thing at the same time. I'd recommand you to take a look at the examples code.google.com/p/andengineexamples –  Kirill Kulakov Nov 26 '12 at 21:18

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.