Book Image

Mastering LibGDX Game Development

By : Patrick Hoey
Book Image

Mastering LibGDX Game Development

By: Patrick Hoey

Overview of this book

Table of Contents (18 chapters)
Mastering LibGDX Game Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Implementing the camera and displaying a map in the render loop


The next class to review is MainGameScreen, which can be found at core/src/com/packtpub/libgdx/bludbourne/screens/MainGameScreen.java. The MainGameScreen class is the first Screen implementation for our game and represents the main gameplay screen used to display the game map, player avatar, and any UI components.

MainGameScreen

The class diagram for MainGameScreen (Figure 8) shows all the attributes and method signatures for our first pass:

Figure 8

The import packages for MainGameScreen are as follows:

package com.packtpub.libgdx.bludbourne.screens;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.maps.MapLayer;
import com.badlogic.gdx.maps.MapObject;
import com.badlogic.gdx.maps.objects.RectangleMapObject...