Package com.badlogic.gdx
Class Game
java.lang.Object
com.badlogic.gdx.Game
- All Implemented Interfaces:
ApplicationListener
An ApplicationListener
that delegates to a Screen
. 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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Called when theApplication
is destroyed.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
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 Details
-
screen
-
-
Constructor Details
-
Game
public Game()
-
-
Method Details
-
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
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
-
getScreen
- Returns:
- the currently active
Screen
.
-