Package com.jme3.system.awt
Class AwtPanelsContext
java.lang.Object
com.jme3.system.awt.AwtPanelsContext
- All Implemented Interfaces:
JmeContext
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.system.JmeContext
JmeContext.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JmeContextprotected AwtPanelprotected AwtKeyInputprotected booleanprotected SystemListenerprotected AwtMouseInputprotected AppSettings -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(boolean waitFor) Creates the context and makes it active.createPanel(PaintMode paintMode) createPanel(PaintMode paintMode, boolean srgb) voiddestroy(boolean waitFor) Destroys the context completely, making it inactive.This call will return a list of Monitors that glfwGetMonitors() returns and information about the monitor, like width, height, and refresh rate.intReturns the height of the input panel.intReturns the width of the input panel.intUse this to get the positional number of the primary monitor from the glfwGetMonitors() function call.Accesses the listener that receives events related to this context.getTimer()getType()intReturns the screen X coordinate of the left edge of the input panel.intReturns the screen Y coordinate of the top edge of the input panel.booleanbooleanvoidrestart()Destroys and then re-creates the context.voidsetAutoFlushFrames(boolean enabled) voidsetInputSource(AwtPanel panel) voidsetSettings(AppSettings settings) voidsetSystemListener(SystemListener listener) Sets the listener that will receive events relating to context creation, update, and destroy.voidSets the title of the display (if available).
-
Field Details
-
actualContext
-
settings
-
listener
-
panels
-
inputSource
-
mouseInput
-
keyInput
-
lastThrottleState
protected boolean lastThrottleState
-
-
Constructor Details
-
AwtPanelsContext
public AwtPanelsContext()
-
-
Method Details
-
setInputSource
-
getType
- Specified by:
getTypein interfaceJmeContext- Returns:
- The type of the context.
-
getSystemListener
Accesses the listener that receives events related to this context.- Specified by:
getSystemListenerin interfaceJmeContext- Returns:
- the pre-existing instance
-
setSystemListener
Description copied from interface:JmeContextSets the listener that will receive events relating to context creation, update, and destroy.- Specified by:
setSystemListenerin interfaceJmeContext- Parameters:
listener- the desired listener
-
getSettings
- Specified by:
getSettingsin interfaceJmeContext- 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
- Specified by:
getRendererin interfaceJmeContext- Returns:
- The renderer for this context, or null if not created yet.
-
getMouseInput
- Specified by:
getMouseInputin interfaceJmeContext- Returns:
- Mouse input implementation. May be null if not available.
-
getKeyInput
- Specified by:
getKeyInputin interfaceJmeContext- Returns:
- Keyboard input implementation. May be null if not available.
-
getJoyInput
- Specified by:
getJoyInputin interfaceJmeContext- Returns:
- Joystick input implementation. May be null if not available.
-
getTouchInput
- Specified by:
getTouchInputin interfaceJmeContext- Returns:
- Touch device input implementation. May be null if not available.
-
getTimer
- Specified by:
getTimerin interfaceJmeContext- Returns:
- The timer for this context, or null if not created yet.
-
isCreated
public boolean isCreated()- Specified by:
isCreatedin interfaceJmeContext- Returns:
- True if the context has been created but not yet destroyed.
-
isRenderable
public boolean isRenderable()- Specified by:
isRenderablein interfaceJmeContext- Returns:
- True if the context contains a valid render surface,
if any of the rendering methods in
Rendererare called while this isfalse, then the result is undefined.
-
getOpenCLContext
- Specified by:
getOpenCLContextin interfaceJmeContext- Returns:
- The OpenCL context if available.
-
createPanel
-
createPanel
-
setSettings
- Specified by:
setSettingsin interfaceJmeContext- 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.
-
create
public void create(boolean waitFor) Description copied from interface:JmeContextCreates the context and makes it active.- Specified by:
createin interfaceJmeContext- Parameters:
waitFor- If true, will wait until context has initialized.
-
destroy
public void destroy(boolean waitFor) Description copied from interface:JmeContextDestroys the context completely, making it inactive.- Specified by:
destroyin interfaceJmeContext- Parameters:
waitFor- If true, will wait until the context is destroyed fully.
-
setTitle
Description copied from interface:JmeContextSets the title of the display (if available). This does nothing for fullscreen, headless, or canvas contexts.- Specified by:
setTitlein interfaceJmeContext- Parameters:
title- The new title of the display.
-
setAutoFlushFrames
public void setAutoFlushFrames(boolean enabled) - Specified by:
setAutoFlushFramesin interfaceJmeContext- Parameters:
enabled- If enabled, the context will automatically flush frames to the video card (swap buffers) after an update cycle.
-
restart
public void restart()Description copied from interface:JmeContextDestroys and then re-creates the context. This should be called after the display settings have been changed.- Specified by:
restartin interfaceJmeContext
-
getFramebufferHeight
public int getFramebufferHeight()Returns the height of the input panel.- Specified by:
getFramebufferHeightin interfaceJmeContext- Returns:
- the height (in pixels)
-
getFramebufferWidth
public int getFramebufferWidth()Returns the width of the input panel.- Specified by:
getFramebufferWidthin interfaceJmeContext- Returns:
- the width (in pixels)
-
getWindowXPosition
public int getWindowXPosition()Returns the screen X coordinate of the left edge of the input panel.- Specified by:
getWindowXPositionin interfaceJmeContext- Returns:
- the screen X coordinate
-
getWindowYPosition
public int getWindowYPosition()Returns the screen Y coordinate of the top edge of the input panel.- Specified by:
getWindowYPositionin interfaceJmeContext- Returns:
- the screen Y coordinate
-
getDisplays
Description copied from interface:JmeContextThis call will return a list of Monitors that glfwGetMonitors() returns and information about the monitor, like width, height, and refresh rate.- Specified by:
getDisplaysin interfaceJmeContext- Returns:
- returns a list of monitors and their information.
-
getPrimaryDisplay
public int getPrimaryDisplay()Description copied from interface:JmeContextUse this to get the positional number of the primary monitor from the glfwGetMonitors() function call.- Specified by:
getPrimaryDisplayin interfaceJmeContext- Returns:
- the position of the value in the arraylist of the primary monitor.
-