APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.backends.headless

public Class HeadlessApplication

extends Object
implements Application
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.Application
Imports
com.badlogic.gdx.Application, .ApplicationListener, .ApplicationLogger, .Audio, .Files, .Gdx, .Graphics, .Input, .LifecycleListener, .Net, .Preferences, com.badlogic.gdx.backends.headless.mock.audio.MockAudio, com.badlogic.gdx.backends.headless.mock.graphics.MockGraphics, com.badlogic.gdx.backends.headless.mock.input.MockInput, com.badlogic.gdx.utils.Array, .Clipboard, .GdxRuntimeException, .ObjectMap, .TimeUtils

a headless implementation of a GDX Application primarily intended to be used in servers
Author
Jon Renner

Field Summary

Modifier and TypeField and Description
protected ApplicationLogger
protected final MockAudio
protected final Array<Runnable>
protected final HeadlessFiles
protected final MockGraphics
protected final MockInput
protected final Array<LifecycleListener>
protected final ApplicationListener
protected int
protected Thread
protected final HeadlessNet
pack-priv ObjectMap<String, Preferences>
private String
protected final Array<Runnable>
protected boolean

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
debug(String tag, String message)

Implements com.badlogic.gdx.Application.debug.

Logs a debug message to the console or logcat

public void
debug(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.debug.

Logs a debug message to the console or logcat

public void
error(String tag, String message)

Implements com.badlogic.gdx.Application.error.

Logs an error message to the console or logcat

public void
error(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.error.

Logs an error message to the console or logcat

public boolean
public void
exit()

Implements com.badlogic.gdx.Application.exit.

Schedule an exit from the application.

public ApplicationListener
public ApplicationLogger
public Audio
public Clipboard
public Files
public Graphics
public Input
public long
public int
getLogLevel()

Implements com.badlogic.gdx.Application.getLogLevel.

Gets the log level.

public long
public Net
public Preferences
getPreferences(String name)

Implements com.badlogic.gdx.Application.getPreferences.

Returns the Preferences instance of this Application.

public Application.ApplicationType
public int
private void
public void
log(String tag, String message)

Implements com.badlogic.gdx.Application.log.

Logs a message to the console or logcat

public void
log(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.log.

Logs a message to the console or logcat

protected void
public void
postRunnable(Runnable runnable)

Implements com.badlogic.gdx.Application.postRunnable.

Posts a Runnable on the main loop thread.

public void
public void
setApplicationLogger(ApplicationLogger applicationLogger)

Implements com.badlogic.gdx.Application.setApplicationLogger.

Sets the current Application logger.

public void
setLogLevel(int logLevel)

Implements com.badlogic.gdx.Application.setLogLevel.

Sets the log level.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applicationLoggerback to summary
protected ApplicationLogger applicationLogger
audioback to summary
protected final MockAudio audio
executedRunnablesback to summary
protected final Array<Runnable> executedRunnables
filesback to summary
protected final HeadlessFiles files
graphicsback to summary
protected final MockGraphics graphics
inputback to summary
protected final MockInput input
lifecycleListenersback to summary
protected final Array<LifecycleListener> lifecycleListeners
listenerback to summary
protected final ApplicationListener listener
logLevelback to summary
protected int logLevel
mainLoopThreadback to summary
protected Thread mainLoopThread
netback to summary
protected final HeadlessNet net
preferencesback to summary
pack-priv ObjectMap<String, Preferences> preferences
preferencesdirback to summary
private String preferencesdir
runnablesback to summary
protected final Array<Runnable> runnables
runningback to summary
protected boolean running

Constructor Detail

HeadlessApplicationback to summary
public HeadlessApplication(ApplicationListener listener)
HeadlessApplicationback to summary
public HeadlessApplication(ApplicationListener listener, HeadlessApplicationConfiguration config)

Method Detail

addLifecycleListenerback to summary
public void addLifecycleListener(LifecycleListener listener)

Implements com.badlogic.gdx.Application.addLifecycleListener.

Doc from com.badlogic.gdx.Application.addLifecycleListener.

Adds a new LifecycleListener to the application. This can be used by extensions to hook into the lifecycle more easily. The ApplicationListener methods are sufficient for application level development.

Annotations
@Override
debugback to summary
public void debug(String tag, String message)

Implements com.badlogic.gdx.Application.debug.

Doc from com.badlogic.gdx.Application.debug.

Logs a debug message to the console or logcat

Annotations
@Override
debugback to summary
public void debug(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.debug.

Doc from com.badlogic.gdx.Application.debug.

Logs a debug message to the console or logcat

Annotations
@Override
errorback to summary
public void error(String tag, String message)

Implements com.badlogic.gdx.Application.error.

Doc from com.badlogic.gdx.Application.error.

Logs an error message to the console or logcat

Annotations
@Override
errorback to summary
public void error(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.error.

Doc from com.badlogic.gdx.Application.error.

Logs an error message to the console or logcat

Annotations
@Override
executeRunnablesback to summary
public boolean executeRunnables()
exitback to summary
public void exit()

Implements com.badlogic.gdx.Application.exit.

Doc from com.badlogic.gdx.Application.exit.

Schedule an exit from the application. On android, this will cause a call to pause() and dispose() some time in the future, it will not immediately finish your application. On iOS this should be avoided in production as it breaks Apples guidelines

Annotations
@Override
getApplicationListenerback to summary
public ApplicationListener getApplicationListener()

Implements com.badlogic.gdx.Application.getApplicationListener.

Annotations
@Override
getApplicationLoggerback to summary
public ApplicationLogger getApplicationLogger()

Implements com.badlogic.gdx.Application.getApplicationLogger.

Annotations
@Override
getAudioback to summary
public Audio getAudio()

Implements com.badlogic.gdx.Application.getAudio.

Annotations
@Override
getClipboardback to summary
public Clipboard getClipboard()

Implements com.badlogic.gdx.Application.getClipboard.

Annotations
@Override
getFilesback to summary
public Files getFiles()

Implements com.badlogic.gdx.Application.getFiles.

Annotations
@Override
getGraphicsback to summary
public Graphics getGraphics()

Implements com.badlogic.gdx.Application.getGraphics.

Annotations
@Override
getInputback to summary
public Input getInput()

Implements com.badlogic.gdx.Application.getInput.

Annotations
@Override
getJavaHeapback to summary
public long getJavaHeap()

Implements com.badlogic.gdx.Application.getJavaHeap.

Annotations
@Override
getLogLevelback to summary
public int getLogLevel()

Implements com.badlogic.gdx.Application.getLogLevel.

Doc from com.badlogic.gdx.Application.getLogLevel.

Gets the log level.

Annotations
@Override
getNativeHeapback to summary
public long getNativeHeap()

Implements com.badlogic.gdx.Application.getNativeHeap.

Annotations
@Override
getNetback to summary
public Net getNet()

Implements com.badlogic.gdx.Application.getNet.

Annotations
@Override
getPreferencesback to summary
public Preferences getPreferences(String name)

Implements com.badlogic.gdx.Application.getPreferences.

Doc from com.badlogic.gdx.Application.getPreferences.

Returns the Preferences instance of this Application. It can be used to store application settings across runs.

Annotations
@Override
getTypeback to summary
public Application.ApplicationType getType()

Implements com.badlogic.gdx.Application.getType.

Annotations
@Override
getVersionback to summary
public int getVersion()

Implements com.badlogic.gdx.Application.getVersion.

Annotations
@Override
initializeback to summary
private void initialize()
logback to summary
public void log(String tag, String message)

Implements com.badlogic.gdx.Application.log.

Doc from com.badlogic.gdx.Application.log.

Logs a message to the console or logcat

Annotations
@Override
logback to summary
public void log(String tag, String message, Throwable exception)

Implements com.badlogic.gdx.Application.log.

Doc from com.badlogic.gdx.Application.log.

Logs a message to the console or logcat

Annotations
@Override
mainLoopback to summary
protected void mainLoop()
postRunnableback to summary
public void postRunnable(Runnable runnable)

Implements com.badlogic.gdx.Application.postRunnable.

Doc from com.badlogic.gdx.Application.postRunnable.

Posts a Runnable on the main loop thread. In a multi-window application, the Gdx#graphics and Gdx#input values may be unpredictable at the time the Runnable is executed. If graphics or input are needed, they can be copied to a variable to be used in the Runnable. For example:

final Graphics graphics = Gdx.graphics;

Annotations
@Override
removeLifecycleListenerback to summary
public void removeLifecycleListener(LifecycleListener listener)

Implements com.badlogic.gdx.Application.removeLifecycleListener.

Doc from com.badlogic.gdx.Application.removeLifecycleListener.

Removes the LifecycleListener.

Annotations
@Override
setApplicationLoggerback to summary
public void setApplicationLogger(ApplicationLogger applicationLogger)

Implements com.badlogic.gdx.Application.setApplicationLogger.

Doc from com.badlogic.gdx.Application.setApplicationLogger.

Sets the current Application logger. Calls to log(String, String) are delegated to this ApplicationLogger

Annotations
@Override
setLogLevelback to summary
public void setLogLevel(int logLevel)

Implements com.badlogic.gdx.Application.setLogLevel.

Doc from com.badlogic.gdx.Application.setLogLevel.

Sets the log level. LOG_NONE will mute all log output. LOG_ERROR will only let error messages through. LOG_INFO will let all non-debug messages through, and LOG_DEBUG will let all messages through.

Annotations
@Override