By Game Over menu, I mean a menu displayed when you die, with an option to play again.
I have two approaches in mind:
Use OpenGL
Have some button textures ready. When the character dies, draw them. Listen for events on those textures.
Use a view
(This is what I'm doing now.) When the user opens the game, I have a basic activity, along with a basic view with a
FrameLayout
: The root is aGlSurfaceView
and there's a menu on top of it (embedded in aLinearLayout
). When the user hits "Play", this menu is translated away (using a translate animation) from the screen, leaving only theGlSurfaceView
visible, with which the user can interact. I was thinking of implementing something similar when the game ends, but I'm not sure where to start.
I don't particularly like the first approach, since implementing button events in OpenGL seems hard.
How should I approach this?