public class LwjglCanvas
extends java.lang.Object
Display#setParent(Canvas)
, which is preferred over AWTGLCanvas
but is limited to a single LwjglCanvas in an
application. All OpenGL calls are done on the EDT. Note that you may need to call stop()
or a Swing application may
deadlock on System.exit due to how LWJGL and/or Swing deal with shutdown hooks.Constructor and Description |
---|
LwjglCanvas(ApplicationListener listener) |
LwjglCanvas(ApplicationListener listener,
LwjglApplicationConfiguration config) |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(LifecycleListener listener) |
LwjglAudio |
createAudio(LwjglApplicationConfiguration config) |
LwjglInput |
createInput(LwjglApplicationConfiguration config) |
void |
debug(java.lang.String tag,
java.lang.String message) |
void |
debug(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
protected void |
disposed()
Called after dispose is complete.
|
void |
error(java.lang.String tag,
java.lang.String message) |
void |
error(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
protected void |
exception(java.lang.Throwable ex) |
boolean |
executeRunnables() |
void |
exit() |
ApplicationListener |
getApplicationListener() |
ApplicationLogger |
getApplicationLogger() |
Audio |
getAudio() |
java.awt.Canvas |
getCanvas() |
Clipboard |
getClipboard() |
Files |
getFiles() |
protected int |
getFrameRate() |
Graphics |
getGraphics() |
Input |
getInput() |
long |
getJavaHeap() |
int |
getLogLevel() |
long |
getNativeHeap() |
Net |
getNet() |
Preferences |
getPreferences(java.lang.String name) |
ApplicationType |
getType() |
int |
getVersion() |
void |
log(java.lang.String tag,
java.lang.String message) |
void |
log(java.lang.String tag,
java.lang.String message,
java.lang.Throwable exception) |
protected void |
postedException(java.lang.Throwable ex,
java.lang.Throwable caller) |
void |
postRunnable(java.lang.Runnable runnable) |
void |
removeLifecycleListener(LifecycleListener listener) |
protected void |
resize(int width,
int height)
Called when the canvas size changes.
|
void |
setApplicationLogger(ApplicationLogger applicationLogger) |
void |
setCursor(java.awt.Cursor cursor) |
protected void |
setDisplayMode(int width,
int height) |
void |
setLogLevel(int logLevel) |
void |
setPostedRunnableStacktraces(boolean postedRunnableStacktraces)
When true,
postRunnable(Runnable) keeps the stacktrace (which is an allocation) so it can be included if the
runnable later throws an exception. |
protected void |
setTitle(java.lang.String title) |
protected void |
start()
Called after
ApplicationListener create and resize, but before the game loop iteration. |
void |
stop() |
protected void |
stopped()
Called when the game loop has stopped.
|
public LwjglCanvas(ApplicationListener listener)
public LwjglCanvas(ApplicationListener listener, LwjglApplicationConfiguration config)
protected void setDisplayMode(int width, int height)
protected void setTitle(java.lang.String title)
public ApplicationListener getApplicationListener()
public java.awt.Canvas getCanvas()
public Audio getAudio()
public Files getFiles()
public Graphics getGraphics()
public Input getInput()
public Net getNet()
public ApplicationType getType()
public int getVersion()
public boolean executeRunnables()
protected void postedException(java.lang.Throwable ex, @Null java.lang.Throwable caller)
protected void exception(java.lang.Throwable ex)
protected int getFrameRate()
protected void start()
ApplicationListener
create and resize, but before the game loop iteration.protected void resize(int width, int height)
protected void stopped()
protected void disposed()
public void stop()
public long getJavaHeap()
public long getNativeHeap()
public Preferences getPreferences(java.lang.String name)
public Clipboard getClipboard()
public void postRunnable(java.lang.Runnable runnable)
public void debug(java.lang.String tag, java.lang.String message)
public void debug(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void log(java.lang.String tag, java.lang.String message)
public void log(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void error(java.lang.String tag, java.lang.String message)
public void error(java.lang.String tag, java.lang.String message, java.lang.Throwable exception)
public void setLogLevel(int logLevel)
public int getLogLevel()
public void setApplicationLogger(ApplicationLogger applicationLogger)
public ApplicationLogger getApplicationLogger()
public void exit()
public void setCursor(java.awt.Cursor cursor)
cursor
- May be null.public void addLifecycleListener(LifecycleListener listener)
public void removeLifecycleListener(LifecycleListener listener)
public void setPostedRunnableStacktraces(boolean postedRunnableStacktraces)
postRunnable(Runnable)
keeps the stacktrace (which is an allocation) so it can be included if the
runnable later throws an exception. Default is false.public LwjglAudio createAudio(LwjglApplicationConfiguration config)
public LwjglInput createInput(LwjglApplicationConfiguration config)