Package com.badlogic.gdx
Class Game
- java.lang.Object
-
- com.badlogic.gdx.Game
-
- All Implemented Interfaces:
ApplicationListener
public abstract class Game extends java.lang.Object implements ApplicationListener
An
ApplicationListenerthat delegates to aScreen. This allows an application to easily have multiple screens.Screens are not disposed automatically. You must handle whether you want to keep screens around or dispose of them when another screen is set.
-
-
Constructor Summary
Constructors Constructor Description Game()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Called when theApplicationis destroyed.ScreengetScreen()voidpause()Called when theApplicationis paused, usually when it's not active or visible on-screen.voidrender()Called when theApplicationshould render itself.voidresize(int width, int height)Called when theApplicationis resized.voidresume()Called when theApplicationis resumed from a paused state, usually when it regains focus.voidsetScreen(Screen screen)Sets the current screen.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.badlogic.gdx.ApplicationListener
create
-
-
-
-
Field Detail
-
screen
protected Screen screen
-
-
Method Detail
-
dispose
public void dispose()
Description copied from interface:ApplicationListenerCalled when theApplicationis destroyed. Preceded by a call toApplicationListener.pause().- Specified by:
disposein interfaceApplicationListener
-
pause
public void pause()
Description copied from interface:ApplicationListenerCalled when theApplicationis paused, usually when it's not active or visible on-screen. An Application is also paused before it is destroyed.- Specified by:
pausein interfaceApplicationListener
-
resume
public void resume()
Description copied from interface:ApplicationListenerCalled when theApplicationis resumed from a paused state, usually when it regains focus.- Specified by:
resumein interfaceApplicationListener
-
render
public void render()
Description copied from interface:ApplicationListenerCalled when theApplicationshould render itself.- Specified by:
renderin interfaceApplicationListener
-
resize
public void resize(int width, int height)Description copied from interface:ApplicationListenerCalled when theApplicationis resized. This can happen at any point during a non-paused state but will never happen before a call toApplicationListener.create().- Specified by:
resizein interfaceApplicationListener- Parameters:
width- the new width in pixelsheight- the new height in pixels
-
setScreen
public void setScreen(Screen screen)
Sets the current screen.Screen.hide()is called on any old screen, andScreen.show()is called on the new screen, if any.- Parameters:
screen- may benull
-
-