Creating Transparent Game Menu Items using AndEngine
Posted
by
Chaitanya Chandurkar
on Game Development
See other posts from Game Development
or by Chaitanya Chandurkar
Published on 2012-11-18T10:26:48Z
Indexed on
2012/11/18
11:28 UTC
Read the original article
Hit count: 467
I'm trying to create a Game Menu which contains some Menu Items like
- New Game
- Multiplayer
- Options
- 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?
© Game Development or respective owner