Game Development Reference
In-Depth Information
We are now ready to begin with the implementation of the game's GUI. It is always
good to have an idea of what should be implemented so that we have a picture of
what we are aiming for, as shown here:
In the top-left corner, you see an image of the gold coin and the player's current score
as text. In the top-right corner, you see three bunny heads that represent the number
of extra lives the player has left. Lastly, in the bottom-right corner is a small FPS
counter that shows how good or bad the performance of the running game is. The
color of the FPS counter will depend on the achieved frames per second.
Add the following import line in WorldRenderer :
import com.badlogic.gdx.graphics.g2d.BitmapFont;
Next, add the following code in WorldRenderer :
private OrthographicCamera cameraGUI;
private void init () {
batch = new SpriteBatch();
camera = new OrthographicCamera(Constants.VIEWPORT_WIDTH,
Constants.VIEWPORT_HEIGHT);
 
Search WWH ::




Custom Search