Package com.jme3.system
Interface JmeContext
- All Known Subinterfaces:
JmeCanvasContext
- All Known Implementing Classes:
AWTContext
,AwtPanelsContext
,IGLESContext
,LwjglAbstractDisplay
,LwjglCanvas
,LwjglContext
,LwjglContextVR
,LwjglDisplay
,LwjglDisplayVR
,LwjglOffscreenBuffer
,LwjglOffscreenBufferVR
,LwjglWindow
,LwjglWindowVR
,NullContext
,OGLESContext
public interface JmeContext
Represents a rendering context within the engine.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
create
(boolean waitFor) Creates the context and makes it active.void
destroy
(boolean waitFor) Destroys the context completely, making it inactive.int
Returns the height of the framebuffer.int
Returns the width of the framebuffer.Accesses the listener that receives events related to this context.getTimer()
getType()
int
Returns the screen X coordinate of the left edge of the content area.int
Returns the screen Y coordinate of the top edge of the content area.boolean
boolean
void
restart()
Destroys and then re-creates the context.void
setAutoFlushFrames
(boolean enabled) void
setSettings
(AppSettings settings) void
setSystemListener
(SystemListener listener) Sets the listener that will receive events relating to context creation, update, and destroy.void
Sets the title of the display (if available).
-
Method Details
-
getType
JmeContext.Type getType()- Returns:
- The type of the context.
-
setSettings
- Parameters:
settings
- the display settings to use for the created context. If the context has already been created, thenrestart()
must be called for the changes to be applied.
-
getSystemListener
SystemListener getSystemListener()Accesses the listener that receives events related to this context.- Returns:
- the pre-existing instance
-
setSystemListener
Sets the listener that will receive events relating to context creation, update, and destroy.- Parameters:
listener
- the desired listener
-
getSettings
AppSettings getSettings()- Returns:
- The current display settings. Note that they might be different from the ones set with setDisplaySettings() if the context was restarted or the settings changed internally.
-
getRenderer
Renderer getRenderer()- Returns:
- The renderer for this context, or null if not created yet.
-
getOpenCLContext
Context getOpenCLContext()- Returns:
- The OpenCL context if available.
-
getMouseInput
MouseInput getMouseInput()- Returns:
- Mouse input implementation. May be null if not available.
-
getKeyInput
KeyInput getKeyInput()- Returns:
- Keyboard input implementation. May be null if not available.
-
getJoyInput
JoyInput getJoyInput()- Returns:
- Joystick input implementation. May be null if not available.
-
getTouchInput
TouchInput getTouchInput()- Returns:
- Touch device input implementation. May be null if not available.
-
getTimer
Timer getTimer()- Returns:
- The timer for this context, or null if not created yet.
-
setTitle
Sets the title of the display (if available). This does nothing for fullscreen, headless, or canvas contexts.- Parameters:
title
- The new title of the display.
-
isCreated
boolean isCreated()- Returns:
- True if the context has been created but not yet destroyed.
-
isRenderable
boolean isRenderable()- Returns:
- True if the context contains a valid render surface,
if any of the rendering methods in
Renderer
are called while this isfalse
, then the result is undefined.
-
setAutoFlushFrames
void setAutoFlushFrames(boolean enabled) - Parameters:
enabled
- If enabled, the context will automatically flush frames to the video card (swap buffers) after an update cycle.
-
create
void create(boolean waitFor) Creates the context and makes it active.- Parameters:
waitFor
- If true, will wait until context has initialized.
-
restart
void restart()Destroys and then re-creates the context. This should be called after the display settings have been changed. -
destroy
void destroy(boolean waitFor) Destroys the context completely, making it inactive.- Parameters:
waitFor
- If true, will wait until the context is destroyed fully.
-
getFramebufferHeight
int getFramebufferHeight()Returns the height of the framebuffer.- Returns:
- the height (in pixels)
- Throws:
IllegalStateException
- for a headless or null context
-
getFramebufferWidth
int getFramebufferWidth()Returns the width of the framebuffer.- Returns:
- the width (in pixels)
- Throws:
IllegalStateException
- for a headless or null context
-
getWindowXPosition
int getWindowXPosition()Returns the screen X coordinate of the left edge of the content area.- Returns:
- the screen X coordinate
- Throws:
IllegalStateException
- for a headless or null context
-
getWindowYPosition
int getWindowYPosition()Returns the screen Y coordinate of the top edge of the content area.- Returns:
- the screen Y coordinate
- Throws:
IllegalStateException
- for a headless or null context
-