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
ApplicationListener
that 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 void
dispose()
Called when theApplication
is destroyed.Screen
getScreen()
void
pause()
Called when theApplication
is paused, usually when it's not active or visible on-screen.void
render()
Called when theApplication
should render itself.void
resize(int width, int height)
Called when theApplication
is resized.void
resume()
Called when theApplication
is resumed from a paused state, usually when it regains focus.void
setScreen(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:ApplicationListener
Called when theApplication
is destroyed. Preceded by a call toApplicationListener.pause()
.- Specified by:
dispose
in interfaceApplicationListener
-
pause
public void pause()
Description copied from interface:ApplicationListener
Called when theApplication
is paused, usually when it's not active or visible on-screen. An Application is also paused before it is destroyed.- Specified by:
pause
in interfaceApplicationListener
-
resume
public void resume()
Description copied from interface:ApplicationListener
Called when theApplication
is resumed from a paused state, usually when it regains focus.- Specified by:
resume
in interfaceApplicationListener
-
render
public void render()
Description copied from interface:ApplicationListener
Called when theApplication
should render itself.- Specified by:
render
in interfaceApplicationListener
-
resize
public void resize(int width, int height)
Description copied from interface:ApplicationListener
Called when theApplication
is resized. This can happen at any point during a non-paused state but will never happen before a call toApplicationListener.create()
.- Specified by:
resize
in 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
-
-