|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectActivity
com.badlogic.gdx.backends.android.AndroidApplication
public class AndroidApplication
An implementation of the Application
interface for Android. Create an Activity
that derives from this class. In
the Activity#onCreate(Bundle)
method call the initialize(ApplicationListener, boolean)
method specifying the
configuration for the GLSurfaceView.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.badlogic.gdx.Application |
---|
Application.ApplicationType |
Field Summary | |
---|---|
protected AndroidAudio |
audio
|
protected Array<java.lang.Runnable> |
executedRunnables
|
protected AndroidFiles |
files
|
protected boolean |
firstResume
|
protected AndroidGraphics |
graphics
|
protected Handler |
handler
|
protected AndroidInput |
input
|
protected ApplicationListener |
listener
|
protected int |
logLevel
|
protected Array<java.lang.Runnable> |
runnables
|
protected WakeLock |
wakeLock
|
Fields inherited from interface com.badlogic.gdx.Application |
---|
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_NONE |
Constructor Summary | |
---|---|
AndroidApplication()
|
Method Summary | |
---|---|
protected FrameLayout.LayoutParams |
createLayoutParams()
|
protected void |
createWakeLock(AndroidApplicationConfiguration config)
|
void |
debug(java.lang.String tag,
java.lang.String message)
Logs a debug message to the console or logcat |
void |
debug(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception)
Logs a debug message to the console or logcat |
void |
error(java.lang.String tag,
java.lang.String message)
Logs an error message to the console or logcat |
void |
error(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception)
Logs an error message to the console or logcat |
void |
exit()
Exits the application. |
Audio |
getAudio()
|
Files |
getFiles()
|
Graphics |
getGraphics()
|
Input |
getInput()
|
long |
getJavaHeap()
|
long |
getNativeHeap()
|
Preferences |
getPreferences(java.lang.String name)
Returns the Preferences instance of this Application. |
Application.ApplicationType |
getType()
|
int |
getVersion()
|
void |
initialize(ApplicationListener listener,
AndroidApplicationConfiguration config)
This method has to be called in the Activity#onCreate(Bundle) method. |
void |
initialize(ApplicationListener listener,
boolean useGL2IfAvailable)
This method has to be called in the Activity#onCreate(Bundle) method. |
View |
initializeForView(ApplicationListener listener,
AndroidApplicationConfiguration config)
This method has to be called in the Activity#onCreate(Bundle) method. |
View |
initializeForView(ApplicationListener listener,
boolean useGL2IfAvailable)
This method has to be called in the Activity#onCreate(Bundle) method. |
void |
log(java.lang.String tag,
java.lang.String message)
Logs a message to the console or logcat |
void |
log(java.lang.String tag,
java.lang.String message,
java.lang.Exception exception)
Logs a message to the console or logcat |
void |
onConfigurationChanged(Configuration config)
|
protected void |
onDestroy()
|
protected void |
onPause()
|
protected void |
onResume()
|
void |
postRunnable(java.lang.Runnable runnable)
Posts a Runnable on the main loop thread. |
void |
setLogLevel(int logLevel)
Sets the log level. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AndroidGraphics graphics
protected AndroidInput input
protected AndroidAudio audio
protected AndroidFiles files
protected ApplicationListener listener
protected Handler handler
protected boolean firstResume
protected final Array<java.lang.Runnable> runnables
protected final Array<java.lang.Runnable> executedRunnables
protected WakeLock wakeLock
protected int logLevel
Constructor Detail |
---|
public AndroidApplication()
Method Detail |
---|
public void initialize(ApplicationListener listener, boolean useGL2IfAvailable)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. If useGL20IfAvailable is set the AndroidApplication will try to create an OpenGL ES 2.0
context which can then be used via Graphics.getGL20()
. The GL10
and GL11
interfaces should not be
used when OpenGL ES 2.0 is enabled. To query whether enabling OpenGL ES 2.0 was successful use the
Graphics.isGL20Available()
method. Uses a default AndroidApplicationConfiguration
.
listener
- the ApplicationListener
implementing the program logicuseGL2IfAvailable
- whether to use OpenGL ES 2.0 if its available.public void initialize(ApplicationListener listener, AndroidApplicationConfiguration config)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. If config.useGL20 is set the AndroidApplication will try to create an OpenGL ES 2.0
context which can then be used via Graphics.getGL20()
. The GL10
and GL11
interfaces should not be
used when OpenGL ES 2.0 is enabled. To query whether enabling OpenGL ES 2.0 was successful use the
Graphics.isGL20Available()
method. You can configure other aspects of the application with the rest of the fields in
the AndroidApplicationConfiguration
instance.
listener
- the ApplicationListener
implementing the program logicconfig
- the AndroidApplicationConfiguration
, defining various settings of the application (use accelerometer,
etc.).protected FrameLayout.LayoutParams createLayoutParams()
protected void createWakeLock(AndroidApplicationConfiguration config)
public View initializeForView(ApplicationListener listener, boolean useGL2IfAvailable)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. If useGL20IfAvailable is set the AndroidApplication will try to create an OpenGL ES 2.0
context which can then be used via Graphics.getGL20()
. The GL10
and GL11
interfaces should not be
used when OpenGL ES 2.0 is enabled. To query whether enabling OpenGL ES 2.0 was successful use the
Graphics.isGL20Available()
method. Uses a default AndroidApplicationConfiguration
.
Note: you have to add the returned view to your layout!
listener
- the ApplicationListener
implementing the program logicuseGL2IfAvailable
- whether to use OpenGL ES 2.0 if its available.
public View initializeForView(ApplicationListener listener, AndroidApplicationConfiguration config)
Activity#onCreate(Bundle)
method. It sets up all the things necessary to get
input, render via OpenGL and so on. If config.useGL20 is set the AndroidApplication will try to create an OpenGL ES 2.0
context which can then be used via Graphics.getGL20()
. The GL10
and GL11
interfaces should not be
used when OpenGL ES 2.0 is enabled. To query whether enabling OpenGL ES 2.0 was successful use the
Graphics.isGL20Available()
method. You can configure other aspects of the application with the rest of the fields in
the AndroidApplicationConfiguration
instance.
Note: you have to add the returned view to your layout!
listener
- the ApplicationListener
implementing the program logicconfig
- the AndroidApplicationConfiguration
, defining various settings of the application (use accelerometer,
etc.).
protected void onPause()
protected void onResume()
protected void onDestroy()
public Audio getAudio()
getAudio
in interface Application
Audio
instancepublic Files getFiles()
getFiles
in interface Application
Files
instancepublic Graphics getGraphics()
getGraphics
in interface Application
Graphics
instancepublic Input getInput()
getInput
in interface Application
Input
instancepublic Application.ApplicationType getType()
getType
in interface Application
Application.ApplicationType
this application has, e.g. Android or Desktoppublic int getVersion()
getVersion
in interface Application
public long getJavaHeap()
getJavaHeap
in interface Application
public long getNativeHeap()
getNativeHeap
in interface Application
public Preferences getPreferences(java.lang.String name)
Application
Preferences
instance of this Application. It can be used to store application settings across runs.
getPreferences
in interface Application
name
- the name of the preferences, must be useable as a file name.
public void postRunnable(java.lang.Runnable runnable)
Application
Runnable
on the main loop thread.
postRunnable
in interface Application
runnable
- the runnable.public void onConfigurationChanged(Configuration config)
public void exit()
Application
exit
in interface Application
public void debug(java.lang.String tag, java.lang.String message)
Application
debug
in interface Application
public void debug(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
Application
debug
in interface Application
public void log(java.lang.String tag, java.lang.String message)
Application
log
in interface Application
public void log(java.lang.String tag, java.lang.String message, java.lang.Exception exception)
Application
log
in interface Application
public void error(java.lang.String tag, java.lang.String message)
Application
error
in interface Application
public void error(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
Application
error
in interface Application
public void setLogLevel(int logLevel)
Application
Application.LOG_NONE
will mute all log output. Application.LOG_ERROR
will only let error messages through.
Application.LOG_INFO
will let all non-debug messages through, and Application.LOG_DEBUG
will let all messages through.
setLogLevel
in interface Application
logLevel
- Application.LOG_NONE
, Application.LOG_ERROR
, Application.LOG_INFO
, Application.LOG_DEBUG
.
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |