Package com.simsilica.lemur
Class GuiGlobals
java.lang.Object
com.simsilica.lemur.GuiGlobals
A utility class that sets up some default global behavior for
the default GUI elements and provides some common access to
things like the AssetManager.
When initialized, GuiGlobals will keep a reference to the AssetManager for use in creating materials, loading fonts, and so on. It will also:
- Setup the KeyInterceptState for allowing edit fields to intercept key events ahead of the regular input processing.
- Initialize InputMapper to provide advanced controller input processing.
- Setup the MouseAppState to provide default mouse listener and picking support for registered pick roots.
- Setup the FocusManagerState that keeps track of the currently focused component and makes sure transition methods are properly called.
- Setup the default styles.
- Sets up the layer based geometry comparators for the default app viewport.
For applications that wish to customize the behavior of GuiGlobals, it is possible to set a custom subclass instead of initializing the default implemenation. Examples of reasons do do this might include using custom materials instead of the default JME materials or otherwise customizing the initialization setup.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateMaterial(boolean lit) createMaterial(ColorRGBA color, boolean lit) createMaterial(Texture texture, boolean lit) createText2d(String fontName) voidfixFont(BitmapFont font) Goes through all of the font page materials and sets alpha test and alpha fall-off.protected AssetManagerDeprecated.protected Stringstatic GuiGlobalsgetScreenCoordinates(Spatial relativeTo, Vector3f pos) Deprecated.booleanhasRequestedCursorEnabled(Object owner) Returns true if the specified owner has an active cursor enabled request pending.static voidinitialize(Application app) booleanprotected booleanisHeadless(Application app) booleanDeprecated.Use isCursorEventsEnabled() instead.voidlightFont(BitmapFont font) loadDefaultIcon(String name) loadTexture(TextureKey key, boolean repeat) loadTexture(String path, boolean repeat, boolean generateMips) booleanreleaseCursorEnabled(Object owner) Releases a previous cursor request for the specified sowner.voidvoidvoidrequestCursorEnabled(Object owner) Indicates that the specified owner requires the cursor to be enabled.voidvoidsetCursorEventsEnabled(boolean f) voidsetCursorEventsEnabled(boolean f, boolean force) The same as setCursorEventsEnabled(f) except that this will force the cursor enabled state even if there are pending requests otherwise.protected voidstatic voidsetInstance(GuiGlobals globals) voidsetMouseEventsEnabled(boolean f) Deprecated.Use setCursorEventsEnabled() instead.voidsetTextFactory(Function<String, Text2d> textFactory) voidsetupGuiComparators(ViewPort view) srgbaColor(float r, float g, float b, float a) Creates a color from the specified RGBA values as if they were in SRGB space, depending on whether gamma correction is enabled or disabled.srgbaColor(ColorRGBA srgbColor) Creates a color from the specified RGBA values as if they were in SRGB space, depending on whether gamma correction is enabled or disabled.
-
Constructor Details
-
GuiGlobals
-
-
Method Details
-
initialize
-
setInstance
-
getInstance
-
isHeadless
-
getAssetManager
-
getIconBase
-
setupGuiComparators
-
setDefaultStyles
protected void setDefaultStyles() -
getStyles
-
getInputMapper
-
getAnimationState
-
getPopupState
-
getFocusManagerState
-
fixFont
Goes through all of the font page materials and sets alpha test and alpha fall-off. -
lightFont
-
loadFont
-
createText2d
-
setTextFactory
-
getTextFactory
-
createMaterial
-
createMaterial
-
createMaterial
-
loadDefaultIcon
-
loadTexture
-
loadTexture
-
srgbaColor
Creates a color from the specified RGBA values as if they were in SRGB space, depending on whether gamma correction is enabled or disabled. If there is no gamma correction then the RGBA values are interpretted literally. If gamma correction is enabled then the values are converted to linear space before returning. -
srgbaColor
Creates a color from the specified RGBA values as if they were in SRGB space, depending on whether gamma correction is enabled or disabled. If there is no gamma correction then the RGBA values are interpretted literally. If gamma correction is enabled then the values are converted to linear space before returning. -
requestFocus
-
releaseFocus
-
getCurrentFocus
-
addKeyListener
-
removeKeyListener
-
getCollisionViewPort
Deprecated. -
requestCursorEnabled
Indicates that the specified owner requires the cursor to be enabled. This is a way of letting multiple separate UI elements manage their need for the cursor. If one particular object indicates that it no longer has a need for the cursor then it can be disabled if no other owners require it. This makes it easier to automatically manage the enabled/disabled state of the picking behavior in the face of complicated UIs. -
releaseCursorEnabled
Releases a previous cursor request for the specified sowner. Returns true if the cursor is still enabled after this call. -
hasRequestedCursorEnabled
Returns true if the specified owner has an active cursor enabled request pending. -
setMouseEventsEnabled
Deprecated.Use setCursorEventsEnabled() instead. -
setCursorEventsEnabled
public void setCursorEventsEnabled(boolean f) -
setCursorEventsEnabled
public void setCursorEventsEnabled(boolean f, boolean force) The same as setCursorEventsEnabled(f) except that this will force the cursor enabled state even if there are pending requests otherwise. This can be a way to force the enabled/disabled state in the case where an application has not converted to the new request/release approach and/or has a specific need where counting requests will not work. -
isMouseEventsEnabled
Deprecated.Use isCursorEventsEnabled() instead. -
isCursorEventsEnabled
public boolean isCursorEventsEnabled() -
getScreenCoordinates
Deprecated.
-