Game Development Reference
In-Depth Information
<string>armv7</string>
<string>opengles-2</string>
</array>
...
</dict>
</plist>
For the desktop and HTML5 project, no extra modifications need to be
made as both of them by default use OpenGL ES 2.0 mode.
In Chapter 7 , Menus and Options , you learned about LibGDX's Game class and used it
to manage and switch back and forth between screens. We are now going to build a
new class that expands on the idea of the Game class to support screen switching as
well as an optional screen transition.
Create a new file for the DirectedGame class and add the following code:
package com.packtpub.libgdx.canyonbunny.screens;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Pixmap.Format;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.packtpub.libgdx.canyonbunny.screens.transitions
.ScreenTransition;
public abstract class DirectedGame implements ApplicationListener
{
private boolean init;
private AbstractGameScreen currScreen;
private AbstractGameScreen nextScreen;
private FrameBuffer currFbo;
private FrameBuffer nextFbo;
private SpriteBatch batch;
private float t;
private ScreenTransition screenTransition;
public void setScreen (AbstractGameScreen screen) {
setScreen(screen, null);
}
 
Search WWH ::




Custom Search