Package com.jme3.system.lwjgl
Class LwjglWindow
java.lang.Object
com.jme3.system.lwjgl.LwjglContext
com.jme3.system.lwjgl.LwjglWindow
- All Implemented Interfaces:
com.jme3.system.JmeContext,Runnable
- Direct Known Subclasses:
LwjglCanvas,LwjglDisplay,LwjglOffscreenBuffer
A wrapper class over the GLFW framework in LWJGL 3.
- Author:
- Daniel Johansson
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jme3.system.JmeContext
com.jme3.system.JmeContext.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected final AtomicBooleanprotected final AtomicBooleanprotected booleanFields inherited from class com.jme3.system.lwjgl.LwjglContext
CL_GL_SHARING_POSSIBLE, clContext, created, createdLock, joyInput, keyInput, listener, mouseInput, renderable, renderer, settings, timer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate(boolean waitFor) protected voidcreateContext(com.jme3.system.AppSettings settings) Apply the settings, changing resolution, etc.protected voidDe-initialize in the OpenGL thread.voiddestroy(boolean waitFor) protected voidDestroy the context.intReturns the height of the framebuffer.intReturns the width of the framebuffer.com.jme3.input.JoyInputcom.jme3.input.KeyInputcom.jme3.input.MouseInputcom.jme3.input.TouchInputcom.jme3.system.JmeContext.TypegetType()com.jme3.math.Vector2fgetWindowContentScale(com.jme3.math.Vector2f store) Get the window content scale, for HiDPI support.longintReturns the screen X coordinate of the left edge of the content area.intReturns the screen Y coordinate of the top edge of the content area.protected booleanDoes LWJGL display initialization in the OpenGL threadvoidregisterWindowSizeListener(WindowSizeListener listener) Registers the specified listener to get notified when window size changes.voidremoveWindowSizeListener(WindowSizeListener listener) Removes the specified listener from the listeners list.voidrestart()Restart if it's a windowed or full-screen display.voidrun()protected voidrunLoop()execute one iteration of the render loop in the OpenGL threadvoidsetAutoFlushFrames(boolean enabled) voidSet the title if it's a windowed displayprotected voidsetWindowIcon(com.jme3.system.AppSettings settings) Set custom icons to the window of this application.protected voidMethods inherited from class com.jme3.system.lwjgl.LwjglContext
create, destroy, determineMaxSamples, getNumSamplesToUse, getOpenCLContext, getRenderer, getSettings, getSystemListener, getTimer, initContextFirstTime, initOpenCL, internalCreate, internalDestroy, isCreated, isRenderable, printContextInitInfo, reinitContext, setSettings, setSystemListener, waitFor
-
Field Details
-
needClose
-
needRestart
-
wasActive
protected boolean wasActive -
autoFlush
protected boolean autoFlush -
allowSwapBuffers
protected boolean allowSwapBuffers
-
-
Constructor Details
-
LwjglWindow
public LwjglWindow(com.jme3.system.JmeContext.Type type)
-
-
Method Details
-
registerWindowSizeListener
Registers the specified listener to get notified when window size changes.- Parameters:
listener- The WindowSizeListener to register.
-
removeWindowSizeListener
Removes the specified listener from the listeners list.- Parameters:
listener- The WindowSizeListener to remove.
-
getType
public com.jme3.system.JmeContext.Type getType()- Specified by:
getTypein interfacecom.jme3.system.JmeContext- Returns:
- Type.Display or Type.Canvas
-
setTitle
Set the title if it's a windowed display- Specified by:
setTitlein interfacecom.jme3.system.JmeContext- Parameters:
title- the title to set
-
restart
public void restart()Restart if it's a windowed or full-screen display.- Specified by:
restartin interfacecom.jme3.system.JmeContext
-
createContext
protected void createContext(com.jme3.system.AppSettings settings) Apply the settings, changing resolution, etc.- Parameters:
settings- the settings to apply when creating the context.
-
showWindow
protected void showWindow() -
setWindowIcon
protected void setWindowIcon(com.jme3.system.AppSettings settings) Set custom icons to the window of this application.- Parameters:
settings- settings for getting the icons
-
destroyContext
protected void destroyContext()Destroy the context. -
create
public void create(boolean waitFor) - Specified by:
createin interfacecom.jme3.system.JmeContext
-
initInThread
protected boolean initInThread()Does LWJGL display initialization in the OpenGL thread- Returns:
- returns
trueif the context initialization was successful
-
runLoop
protected void runLoop()execute one iteration of the render loop in the OpenGL thread -
deinitInThread
protected void deinitInThread()De-initialize in the OpenGL thread. -
run
public void run() -
getJoyInput
public com.jme3.input.JoyInput getJoyInput()- Specified by:
getJoyInputin interfacecom.jme3.system.JmeContext
-
getMouseInput
public com.jme3.input.MouseInput getMouseInput()- Specified by:
getMouseInputin interfacecom.jme3.system.JmeContext
-
getKeyInput
public com.jme3.input.KeyInput getKeyInput()- Specified by:
getKeyInputin interfacecom.jme3.system.JmeContext
-
getTouchInput
public com.jme3.input.TouchInput getTouchInput()- Specified by:
getTouchInputin interfacecom.jme3.system.JmeContext
-
setAutoFlushFrames
public void setAutoFlushFrames(boolean enabled) - Specified by:
setAutoFlushFramesin interfacecom.jme3.system.JmeContext
-
destroy
public void destroy(boolean waitFor) - Specified by:
destroyin interfacecom.jme3.system.JmeContext
-
getWindowHandle
public long getWindowHandle() -
getWindowContentScale
public com.jme3.math.Vector2f getWindowContentScale(com.jme3.math.Vector2f store) Get the window content scale, for HiDPI support. The content scale is the ratio between the current DPI and the platform's default DPI. This is especially important for text and any UI elements. If the pixel dimensions of your UI scaled by this look appropriate on your machine then it should appear at a reasonable size on other machines regardless of their DPI and scaling settings. This relies on the system DPI and scaling settings being somewhat correct.- Parameters:
store- A vector2f to store the result- Returns:
- The window content scale
- See Also:
-
getFramebufferHeight
public int getFramebufferHeight()Returns the height of the framebuffer.- Specified by:
getFramebufferHeightin interfacecom.jme3.system.JmeContext- Returns:
- the height (in pixels)
-
getFramebufferWidth
public int getFramebufferWidth()Returns the width of the framebuffer.- Specified by:
getFramebufferWidthin interfacecom.jme3.system.JmeContext- Returns:
- the width (in pixels)
-
getWindowXPosition
public int getWindowXPosition()Returns the screen X coordinate of the left edge of the content area.- Specified by:
getWindowXPositionin interfacecom.jme3.system.JmeContext- Returns:
- the screen X coordinate
-
getWindowYPosition
public int getWindowYPosition()Returns the screen Y coordinate of the top edge of the content area.- Specified by:
getWindowYPositionin interfacecom.jme3.system.JmeContext- Returns:
- the screen Y coordinate
-