public class JglfwApplication extends java.lang.Object implements Application
Application.ApplicationType
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_NONE
Constructor and Description |
---|
JglfwApplication(ApplicationListener listener) |
JglfwApplication(ApplicationListener listener,
JglfwApplicationConfiguration config) |
JglfwApplication(ApplicationListener listener,
java.lang.String title,
int width,
int height,
boolean useGL2) |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(LifecycleListener listener)
Adds a new
LifecycleListener to the application. |
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
|
protected void |
end()
Called when the game loop has exited.
|
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
|
protected void |
exception(java.lang.Throwable ex)
Called when an uncaught exception happens in the game loop.
|
boolean |
executeRunnables() |
void |
exit()
Schedule an exit from the application.
|
protected void |
frame()
Handles posted runnables, input, and rendering for each frame.
|
ApplicationListener |
getApplicationListener() |
Audio |
getAudio() |
GlfwCallbacks |
getCallbacks() |
Clipboard |
getClipboard() |
JglfwFiles |
getFiles() |
JglfwGraphics |
getGraphics() |
JglfwInput |
getInput() |
long |
getJavaHeap() |
int |
getLogLevel()
Gets the log level.
|
long |
getNativeHeap() |
JglfwNet |
getNet() |
Preferences |
getPreferences(java.lang.String name)
Returns the
Preferences instance of this Application. |
Application.ApplicationType |
getType() |
int |
getVersion() |
boolean |
isPaused() |
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.Throwable exception)
Logs a message to the console or logcat
|
void |
postRunnable(java.lang.Runnable runnable)
Posts a
Runnable on the main loop thread. |
void |
removeLifecycleListener(LifecycleListener listener)
Removes the
LifecycleListener . |
void |
setBackgroundFPS(int backgroundFPS) |
void |
setForegroundFPS(int foregroundFPS) |
void |
setHiddenFPS(int hiddenFPS) |
void |
setLogLevel(int logLevel)
Sets the log level.
|
protected boolean |
shouldExit() |
protected void |
start()
Starts the game loop after the application internals have been initialized.
|
public JglfwApplication(ApplicationListener listener)
public JglfwApplication(ApplicationListener listener, java.lang.String title, int width, int height, boolean useGL2)
public JglfwApplication(ApplicationListener listener, JglfwApplicationConfiguration config)
protected void exception(java.lang.Throwable ex)
protected void start()
protected void frame()
public boolean executeRunnables()
protected void end()
public ApplicationListener getApplicationListener()
getApplicationListener
in interface Application
ApplicationListener
instancepublic JglfwGraphics getGraphics()
getGraphics
in interface Application
Graphics
instancepublic Audio getAudio()
getAudio
in interface Application
Audio
instancepublic JglfwInput getInput()
getInput
in interface Application
Input
instancepublic JglfwFiles getFiles()
getFiles
in interface Application
Files
instancepublic JglfwNet getNet()
getNet
in interface Application
Net
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 Clipboard getClipboard()
getClipboard
in interface Application
public void postRunnable(java.lang.Runnable runnable)
Application
Runnable
on the main loop thread.postRunnable
in interface Application
runnable
- the runnable.public boolean isPaused()
public void setForegroundFPS(int foregroundFPS)
public void setBackgroundFPS(int backgroundFPS)
public void setHiddenFPS(int hiddenFPS)
protected boolean shouldExit()
public void exit()
Application
exit
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
.public int getLogLevel()
Application
getLogLevel
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.Throwable 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 addLifecycleListener(LifecycleListener listener)
Application
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.addLifecycleListener
in interface Application
public void removeLifecycleListener(LifecycleListener listener)
Application
LifecycleListener
.removeLifecycleListener
in interface Application
public GlfwCallbacks getCallbacks()