Package io.tlf.jme.jfx.injme
Class JmeFxContainerImpl
- java.lang.Object
-
- io.tlf.jme.jfx.injme.JmeFxContainerImpl
-
- All Implemented Interfaces:
JmeFxContainer,JmeFxContainerInternal
public class JmeFxContainerImpl extends java.lang.Object implements JmeFxContainer, JmeFxContainerInternal
The container which interacts with jME and includes javaFX scene.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.jme3.app.ApplicationapplicationThe jME application.protected CursorDisplayProvidercursorProviderThe current cursor provider.protected com.sun.javafx.stage.EmbeddedWindowembeddedWindowThe embedded window.protected booleanenabledThe flag of enabling javaFX.protected booleanfocusedThe flag of having focused.protected booleanfullScreenSupportThe flag of supporting full screen.protected java.nio.ByteBufferfxDataThe data buffer of javaFX frame on javaFX side.protected com.sun.javafx.embed.HostInterfacehostInterfaceThe host interface.protected JmeFXInputListenerinputListenerThe user input listener.protected java.nio.ByteBufferjmeDataThe data of javaFX frame on the jME side.protected com.jme3.texture.ImagejmeImageThe image of jME presentation of javaFX frame.protected longlastResizedThe time of last resized window.protected java.util.concurrent.CompletableFuture<com.jme3.texture.Image.Format>nativeFormatprotected intpositionXThe X position of this container.protected intpositionYThe Y position of this container.protected java.util.function.Function<java.nio.ByteBuffer,java.lang.Void>reorderDataThe function to reorder pixels.protected javafx.scene.GrouprootNodeThe root UI node.protected javafx.scene.ScenesceneThe current scene.protected intsceneHeightThe height of javaFX scene.protected com.sun.javafx.embed.EmbeddedSceneInterfacesceneInterfaceThe current embedded scene interface.protected intsceneWidthThe width of javaFX scene.protected com.sun.javafx.embed.EmbeddedStageInterfacestageInterfaceThe current embedded stage interface.protected java.nio.ByteBuffertempDataThe temp data to transfer frames between javaFX and jME.protected java.nio.IntBuffertempIntDataThe int presentation of thetempData.protected booleanvisibleCursorThe flag of visibility cursor.
-
Constructor Summary
Constructors Modifier Constructor Description protectedJmeFxContainerImpl(com.jme3.asset.AssetManager assetManager, com.jme3.app.Application application, CursorDisplayProvider cursorProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfitSceneToWindowSize()Fit scene to window size.com.jme3.app.ApplicationgetApplication()Gets the jME application.CursorDisplayProvidergetCursorProvider()Gets the current cursor provider.com.sun.javafx.stage.EmbeddedWindowgetEmbeddedWindow()Gets the embedded window.JmeFXInputListenergetInputListener()Gets the user input listener.com.jme3.system.JmeContextgetJmeContext()Gets the jME context.floatgetPixelScaleFactor()Gets the target pixel factor.intgetPositionX()Gets the X position.intgetPositionY()Gets the Y position.javafx.scene.GroupgetRootNode()Gets the root UI node.javafx.scene.ScenegetScene()Gets the current scene.intgetSceneHeight()Gets the scene height.com.sun.javafx.embed.EmbeddedSceneInterfacegetSceneInterface()Gets the current scene interface.intgetSceneWidth()Gets the scene width.com.sun.javafx.embed.EmbeddedStageInterfacegetStageInterface()Gets the current stage interface.voidgrabFocus()Get focused.static JmeFxContainerImplinstall(com.jme3.app.Application application, com.jme3.scene.Node guiNode)Build the JavaFX container for the application.static JmeFxContainerImplinstall(com.jme3.app.Application application, com.jme3.scene.Node guiNode, CursorDisplayProvider cursorProvider)Build the JavaFX container for the application.booleanisCovered(int x, int y)Checks the coordinates.booleanisEnabled()booleanisFocused()booleanisFullScreenSupport()booleanisNeedWriteToJme()Checks of existing waiting frames.booleanisVisibleCursor()voidloseFocus()Lose focused.voidmove(int positionX, int positionY)Moves the container to the new position.voidrequestEnabled(boolean enabled)Requests the status of enabled scene.booleanrequestFocus()Requests focus.voidrequestPreferredSize(int width, int height)Requests the preferred size for UI.voidrequestRedraw()Draw new frame of JavaFX to byte buffer.voidrequestShowingCursor(com.sun.javafx.cursor.CursorFrame cursorFrame)Request showing the cursor frame.voidsetEmbeddedWindow(com.sun.javafx.stage.EmbeddedWindow embeddedWindow)Sets the embedded window.voidsetPositionX(int positionX)Sets the X position.voidsetPositionY(int positionY)Sets the Y position.voidsetScene(javafx.scene.Scene newScene, javafx.scene.Group rootNode)Set a new scene to this container.voidsetSceneHeight(int sceneHeight)Sets the scene height.voidsetSceneInterface(com.sun.javafx.embed.EmbeddedSceneInterface sceneInterface)Sets the current scene interface.voidsetSceneWidth(int sceneWidth)Sets the scene width.voidsetStageInterface(com.sun.javafx.embed.EmbeddedStageInterface stageInterface)Sets the current stage interface.voidsetVisibleCursor(boolean visibleCursor)java.lang.VoidwriteToJme()Write javaFX frame to jME texture.
-
-
-
Field Detail
-
nativeFormat
protected volatile java.util.concurrent.CompletableFuture<com.jme3.texture.Image.Format> nativeFormat
-
application
protected final com.jme3.app.Application application
The jME application.
-
cursorProvider
protected final CursorDisplayProvider cursorProvider
The current cursor provider.
-
hostInterface
protected final com.sun.javafx.embed.HostInterface hostInterface
The host interface.
-
inputListener
protected volatile JmeFXInputListener inputListener
The user input listener.
-
stageInterface
protected volatile com.sun.javafx.embed.EmbeddedStageInterface stageInterface
The current embedded stage interface.
-
sceneInterface
protected volatile com.sun.javafx.embed.EmbeddedSceneInterface sceneInterface
The current embedded scene interface.
-
embeddedWindow
protected volatile com.sun.javafx.stage.EmbeddedWindow embeddedWindow
The embedded window.
-
scene
protected volatile javafx.scene.Scene scene
The current scene.
-
rootNode
protected volatile javafx.scene.Group rootNode
The root UI node.
-
jmeImage
protected volatile com.jme3.texture.Image jmeImage
The image of jME presentation of javaFX frame.
-
jmeData
protected volatile java.nio.ByteBuffer jmeData
The data of javaFX frame on the jME side.
-
fxData
protected volatile java.nio.ByteBuffer fxData
The data buffer of javaFX frame on javaFX side.
-
tempData
protected volatile java.nio.ByteBuffer tempData
The temp data to transfer frames between javaFX and jME.
-
tempIntData
protected volatile java.nio.IntBuffer tempIntData
The int presentation of thetempData.
-
reorderData
protected volatile java.util.function.Function<java.nio.ByteBuffer,java.lang.Void> reorderData
The function to reorder pixels.
-
lastResized
protected volatile long lastResized
The time of last resized window.
-
sceneWidth
protected volatile int sceneWidth
The width of javaFX scene.
-
sceneHeight
protected volatile int sceneHeight
The height of javaFX scene.
-
positionX
protected volatile int positionX
The X position of this container.
-
positionY
protected volatile int positionY
The Y position of this container.
-
focused
protected volatile boolean focused
The flag of having focused.
-
fullScreenSupport
protected volatile boolean fullScreenSupport
The flag of supporting full screen.
-
visibleCursor
protected volatile boolean visibleCursor
The flag of visibility cursor.
-
enabled
protected volatile boolean enabled
The flag of enabling javaFX.
-
-
Constructor Detail
-
JmeFxContainerImpl
protected JmeFxContainerImpl(com.jme3.asset.AssetManager assetManager, com.jme3.app.Application application, CursorDisplayProvider cursorProvider)
-
-
Method Detail
-
install
public static JmeFxContainerImpl install(com.jme3.app.Application application, com.jme3.scene.Node guiNode)
Build the JavaFX container for the application.- Parameters:
application- the application.guiNode- the GUI node.- Returns:
- the javaFX container.
-
install
public static JmeFxContainerImpl install(com.jme3.app.Application application, com.jme3.scene.Node guiNode, CursorDisplayProvider cursorProvider)
Build the JavaFX container for the application.- Parameters:
application- the application.guiNode- the GUI node.cursorProvider- the cursor provider.- Returns:
- the javaFX container.
-
requestPreferredSize
public void requestPreferredSize(int width, int height)Description copied from interface:JmeFxContainerInternalRequests the preferred size for UI.- Specified by:
requestPreferredSizein interfaceJmeFxContainerInternal- Parameters:
width- the preferred width.height- the preferred height.
-
requestFocus
public boolean requestFocus()
Description copied from interface:JmeFxContainerInternalRequests focus.- Specified by:
requestFocusin interfaceJmeFxContainerInternal- Returns:
- true if it was successful.
-
getApplication
public com.jme3.app.Application getApplication()
Description copied from interface:JmeFxContainerInternalGets the jME application.- Specified by:
getApplicationin interfaceJmeFxContainerInternal- Returns:
- the jME application.
-
getJmeContext
public com.jme3.system.JmeContext getJmeContext()
Description copied from interface:JmeFxContainerInternalGets the jME context.- Specified by:
getJmeContextin interfaceJmeFxContainerInternal- Returns:
- the jME context.
-
getCursorProvider
public CursorDisplayProvider getCursorProvider()
Description copied from interface:JmeFxContainerGets the current cursor provider.- Specified by:
getCursorProviderin interfaceJmeFxContainer- Returns:
- the current cursor provider.
-
getInputListener
public JmeFXInputListener getInputListener()
Description copied from interface:JmeFxContainerInternalGets the user input listener.- Specified by:
getInputListenerin interfaceJmeFxContainerInternal- Returns:
- the user input listener.
-
getPositionX
public int getPositionX()
Description copied from interface:JmeFxContainerInternalGets the X position.- Specified by:
getPositionXin interfaceJmeFxContainerInternal- Returns:
- the X position.
-
setPositionX
public void setPositionX(int positionX)
Description copied from interface:JmeFxContainerInternalSets the X position.- Specified by:
setPositionXin interfaceJmeFxContainerInternal- Parameters:
positionX- the X position.
-
getPositionY
public int getPositionY()
Description copied from interface:JmeFxContainerInternalGets the Y position.- Specified by:
getPositionYin interfaceJmeFxContainerInternal- Returns:
- the Y position.
-
setPositionY
public void setPositionY(int positionY)
Description copied from interface:JmeFxContainerInternalSets the Y position.- Specified by:
setPositionYin interfaceJmeFxContainerInternal- Parameters:
positionY- the Y position.
-
getSceneHeight
public int getSceneHeight()
Description copied from interface:JmeFxContainerInternalGets the scene height.- Specified by:
getSceneHeightin interfaceJmeFxContainerInternal- Returns:
- the scene height.
-
setSceneHeight
public void setSceneHeight(int sceneHeight)
Description copied from interface:JmeFxContainerInternalSets the scene height.- Specified by:
setSceneHeightin interfaceJmeFxContainerInternal- Parameters:
sceneHeight- the scene height.
-
getSceneWidth
public int getSceneWidth()
Description copied from interface:JmeFxContainerInternalGets the scene width.- Specified by:
getSceneWidthin interfaceJmeFxContainerInternal- Returns:
- the scene width.
-
setSceneWidth
public void setSceneWidth(int sceneWidth)
Description copied from interface:JmeFxContainerInternalSets the scene width.- Specified by:
setSceneWidthin interfaceJmeFxContainerInternal- Parameters:
sceneWidth- the scene width.
-
getPixelScaleFactor
public float getPixelScaleFactor()
Description copied from interface:JmeFxContainerInternalGets the target pixel factor.- Specified by:
getPixelScaleFactorin interfaceJmeFxContainerInternal- Returns:
- the target pixel factor.
-
getRootNode
public javafx.scene.Group getRootNode()
Description copied from interface:JmeFxContainerGets the root UI node.- Specified by:
getRootNodein interfaceJmeFxContainer- Returns:
- the root UI node.
-
getScene
public javafx.scene.Scene getScene()
Description copied from interface:JmeFxContainerGets the current scene.- Specified by:
getScenein interfaceJmeFxContainer- Returns:
- the current scene.
-
getSceneInterface
public com.sun.javafx.embed.EmbeddedSceneInterface getSceneInterface()
Description copied from interface:JmeFxContainerInternalGets the current scene interface.- Specified by:
getSceneInterfacein interfaceJmeFxContainerInternal- Returns:
- the current scene interface.
-
setSceneInterface
public void setSceneInterface(com.sun.javafx.embed.EmbeddedSceneInterface sceneInterface)
Description copied from interface:JmeFxContainerInternalSets the current scene interface.- Specified by:
setSceneInterfacein interfaceJmeFxContainerInternal- Parameters:
sceneInterface- the current scene interface.
-
getEmbeddedWindow
public com.sun.javafx.stage.EmbeddedWindow getEmbeddedWindow()
Description copied from interface:JmeFxContainerInternalGets the embedded window.- Specified by:
getEmbeddedWindowin interfaceJmeFxContainerInternal- Returns:
- the embedded window.
-
setEmbeddedWindow
public void setEmbeddedWindow(com.sun.javafx.stage.EmbeddedWindow embeddedWindow)
Description copied from interface:JmeFxContainerInternalSets the embedded window.- Specified by:
setEmbeddedWindowin interfaceJmeFxContainerInternal- Parameters:
embeddedWindow- the embedded window.
-
getStageInterface
public com.sun.javafx.embed.EmbeddedStageInterface getStageInterface()
Description copied from interface:JmeFxContainerInternalGets the current stage interface.- Specified by:
getStageInterfacein interfaceJmeFxContainerInternal- Returns:
- the current stage interface.
-
setStageInterface
public void setStageInterface(com.sun.javafx.embed.EmbeddedStageInterface stageInterface)
Description copied from interface:JmeFxContainerInternalSets the current stage interface.- Specified by:
setStageInterfacein interfaceJmeFxContainerInternal- Parameters:
stageInterface- the current stage interface.
-
grabFocus
public void grabFocus()
Description copied from interface:JmeFxContainerInternalGet focused.- Specified by:
grabFocusin interfaceJmeFxContainerInternal
-
fitSceneToWindowSize
public void fitSceneToWindowSize()
Description copied from interface:JmeFxContainerInternalFit scene to window size.- Specified by:
fitSceneToWindowSizein interfaceJmeFxContainerInternal
-
move
public void move(int positionX, int positionY)Description copied from interface:JmeFxContainerInternalMoves the container to the new position.- Specified by:
movein interfaceJmeFxContainerInternal- Parameters:
positionX- the new X position.positionY- the new Y position.
-
isCovered
public boolean isCovered(int x, int y)Description copied from interface:JmeFxContainerInternalChecks the coordinates.- Specified by:
isCoveredin interfaceJmeFxContainerInternal- Parameters:
x- the X coordinate.y- the Y coordinate.- Returns:
- true if the coordinates is covered.
-
isFocused
public boolean isFocused()
- Specified by:
isFocusedin interfaceJmeFxContainerInternal- Returns:
- true if the windows has focused.
-
isFullScreenSupport
public boolean isFullScreenSupport()
- Returns:
- true if this container is supported fullscreen.
-
isNeedWriteToJme
public boolean isNeedWriteToJme()
Description copied from interface:JmeFxContainerChecks of existing waiting frames.- Specified by:
isNeedWriteToJmein interfaceJmeFxContainer- Returns:
- true if need to write javaFx frame.
-
isVisibleCursor
public boolean isVisibleCursor()
- Returns:
- true if the cursor is visible.
-
setVisibleCursor
public void setVisibleCursor(boolean visibleCursor)
- Parameters:
visibleCursor- true if the cursor is visible.
-
loseFocus
public void loseFocus()
Description copied from interface:JmeFxContainerInternalLose focused.- Specified by:
loseFocusin interfaceJmeFxContainerInternal
-
requestRedraw
public void requestRedraw()
Description copied from interface:JmeFxContainerInternalDraw new frame of JavaFX to byte buffer.- Specified by:
requestRedrawin interfaceJmeFxContainerInternal
-
setScene
public void setScene(javafx.scene.Scene newScene, javafx.scene.Group rootNode)Description copied from interface:JmeFxContainerSet a new scene to this container.- Specified by:
setScenein interfaceJmeFxContainer- Parameters:
newScene- the new scene or null.rootNode- the new root of the scene.
-
requestShowingCursor
public void requestShowingCursor(com.sun.javafx.cursor.CursorFrame cursorFrame)
Description copied from interface:JmeFxContainerInternalRequest showing the cursor frame.- Specified by:
requestShowingCursorin interfaceJmeFxContainerInternal- Parameters:
cursorFrame- the cursor frame.
-
writeToJme
public java.lang.Void writeToJme()
Description copied from interface:JmeFxContainerWrite javaFX frame to jME texture.- Specified by:
writeToJmein interfaceJmeFxContainer
-
requestEnabled
public void requestEnabled(boolean enabled)
Description copied from interface:JmeFxContainerInternalRequests the status of enabled scene.- Specified by:
requestEnabledin interfaceJmeFxContainerInternal- Parameters:
enabled- the flag of enabling javaFX.
-
isEnabled
public boolean isEnabled()
- Returns:
- true if the javaFx is enabled.
-
-