Class Settings
-
- All Implemented Interfaces:
public final class SettingsSettings for PolyUI.
This contains many values that concern the rendering and event handling of PolyUI internally.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumSettings.ResourcePolicyHow to handle resource (image and font) loading errors.
-
Field Summary
Fields Modifier and Type Field Description private Booleandebugprivate BooleanenableDebugKeybindprivate IntegermaxFPSprivate IntegerunfocusedFPSprivate BooleanenableVSyncprivate StringdefaultLocaleprivate Settings.ResourcePolicyresourcePolicyprivate BooleanisMasterFrameBufferprivate IntegerminDrawablesForFramebufferprivate BooleanframebuffersEnabledprivate BooleanrenderPausingEnabledprivate LongcomboMaxIntervalprivate IntegermaxComboSizeprivate BooleanclearComboWhenMaxedprivate FloatdragThresholdprivate Vec2scrollMultiplierprivate BooleannaturalScrollingprivate Vec2minimumSizeprivate Vec2maximumSizeprivate Pair<Integer, Integer>aspectRatioprivate BooleancleanupAfterInitprivate BooleancleanupOnShutdownprivate BooleanloadTranslationsOnInitprivate BooleanforceSetsInitialSize
-
Constructor Summary
Constructors Constructor Description Settings()
-
Method Summary
Modifier and Type Method Description final BooleanisDebugMode()this enables the debug renderer and various other debug features, including more verbose checks and logging. final UnitenableDebugMode(Boolean debug)this enables the debug renderer and various other debug features, including more verbose checks and logging. final BooleanhasDebugKeybind()enable the debug keybind in the window (Ctrl+Shift+I) final UnitenableDebugKeybind(Boolean enableDebugKeybind)enable the debug keybind in the window (Ctrl+Shift+I) final IntegergetMaxFPS()set this to something other than 0 to set a framerate cap for the UI. final UnitsetMaxFPS(Integer maxFPS)set this to something other than 0 to set a framerate cap for the UI. final IntegergetUnfocusedFPS()set this to something other than 0 to change the framerate from the current maxFPS to this value when it is unfocused. final UnitsetUnfocusedFPS(Integer unfocusedFPS)set this to something other than 0 to change the framerate from the current maxFPS to this value when it is unfocused. final BooleanisVSyncEnabled()final UnitenableVSync(Boolean enableVSync)final StringgetDefaultLocale()final UnitsetDefaultLocale(String defaultLocale)final Settings.ResourcePolicygetResourcePolicy()How to handle resource (image and font) loading errors. final UnitsetResourcePolicy(Settings.ResourcePolicy resourcePolicy)How to handle resource (image and font) loading errors. final BooleanisMasterFrameBuffer()If true, the renderer will render all layout and component to a 'master' framebuffer, then every frame, render that. final UnitsetMasterFrameBuffer(@ApiStatus.Experimental() Boolean isMasterFrameBuffer)If true, the renderer will render all layout and component to a 'master' framebuffer, then every frame, render that. final IntegergetMinDrawablesForFramebuffer()minimum number of drawables in a group before it will use a framebuffer. final UnitsetMinDrawablesForFramebuffer(@ApiStatus.Experimental() Integer minDrawablesForFramebuffer)minimum number of drawables in a group before it will use a framebuffer. final BooleanframebuffersEnabled()Enable or disable framebuffers. final UnitenableFramebuffers(@ApiStatus.Experimental() Boolean framebuffersEnabled)Enable or disable framebuffers. final BooleanisRenderPausingEnabled()This optimization enables "render pausing", or allowing the renderer to pause rendering when there are no changes to the UI. final UnitenableRenderPausing(Boolean renderPausingEnabled)This optimization enables "render pausing", or allowing the renderer to pause rendering when there are no changes to the UI. final LonggetComboMaxInterval()the time between clicks for them to be considered as a combo. final UnitsetComboMaxInterval(Long comboMaxInterval)the time between clicks for them to be considered as a combo. final IntegergetMaxComboSize()maximum amount of clicks that can be combo-ed in any interval final UnitsetMaxComboSize(Integer maxComboSize)maximum amount of clicks that can be combo-ed in any interval final BooleanenableComboClearing()if true, the combo will be cleared when it reaches maxComboSize. final UnitshouldClearComboWhenMaxed(Boolean clearComboWhenMaxed)if true, the combo will be cleared when it reaches maxComboSize. final FloatgetDragThreshold()The threshold for a drag to be considered a 'drag', meaning the drag event will begin to be dispatched, in pixels. final UnitsetDragThreshold(Float dragThreshold)The threshold for a drag to be considered a 'drag', meaning the drag event will begin to be dispatched, in pixels. final Vec2getScrollMultiplier()Scroll multiplier factor, which will multiply the returned value of the callback by this value. final UnitsetScrollMultiplier(Vec2 scrollMultiplier)Scroll multiplier factor, which will multiply the returned value of the callback by this value. final BooleanisNaturalScrolling()Weather to invert the scroll direction final UnitenableNaturalScrolling(Boolean naturalScrolling)Weather to invert the scroll direction final Vec2getMinimumSize()Set the minimum renderer size (width by height) that this instance can be resized to. final UnitsetMinimumSize(Vec2 minimumSize)Set the minimum renderer size (width by height) that this instance can be resized to. final Vec2getMaximumSize()Set the maximum renderer size (width by height) that this instance can be resized to. final UnitsetMaximumSize(Vec2 maximumSize)Set the maximum renderer size (width by height) that this instance can be resized to. final Pair<Integer, Integer>getAspectRatio()Set the renderer aspect ratio, with the ratio being width:height, e.g. final UnitsetAspectRatio(Pair<Integer, Integer> aspectRatio)Set the renderer aspect ratio, with the ratio being width:height, e.g. final BooleanwillCleanupAfterInit()This property will explicitly clean up after the initialization of PolyUI, calling the garbage collector to free up temporary objects created during initialization. final UnitenableInitCleanup(Boolean cleanupAfterInit)This property will explicitly clean up after the initialization of PolyUI, calling the garbage collector to free up temporary objects created during initialization. final BooleanwillCleanupOnShutdown()This property will run the cleanup() method in a shutdown hook which will free memory used by PolyUI. final UnitenableShutdownCleanup(Boolean cleanupOnShutdown)This property will run the cleanup() method in a shutdown hook which will free memory used by PolyUI. final BooleanshouldLoadTranslationsOnInit()Set this to true to enable loading of translation keys upon startup, instead of the default behaviour of loading them when they are first used. final UnitenableTranslationLoadingOnInit(Boolean loadTranslationsOnInit)Set this to true to enable loading of translation keys upon startup, instead of the default behaviour of loading them when they are first used. final BooleanforceSetsInitialSize()This property will mean that, if forceis true in theresizemethod, the initial size will be set to the size given.final UnitenableForceSettingInitialSize(Boolean forceSetsInitialSize)This property will mean that, if forceis true in theresizemethod, the initial size will be set to the size given.-
-
Method Detail
-
isDebugMode
final Boolean isDebugMode()
this enables the debug renderer and various other debug features, including more verbose checks and logging.
It can be enabled using
-Dpolyui.debug=truein the JVM arguments, or by pressing Ctrl+Shift+I in the application if enabled.
-
enableDebugMode
final Unit enableDebugMode(Boolean debug)
this enables the debug renderer and various other debug features, including more verbose checks and logging.
It can be enabled using
-Dpolyui.debug=truein the JVM arguments, or by pressing Ctrl+Shift+I in the application if enabled.
-
hasDebugKeybind
final Boolean hasDebugKeybind()
enable the debug keybind in the window (Ctrl+Shift+I)
-
enableDebugKeybind
final Unit enableDebugKeybind(Boolean enableDebugKeybind)
enable the debug keybind in the window (Ctrl+Shift+I)
-
getMaxFPS
final Integer getMaxFPS()
set this to something other than 0 to set a framerate cap for the UI.
Most implementations will only use this if vsync is disabled.
-
setMaxFPS
final Unit setMaxFPS(Integer maxFPS)
set this to something other than 0 to set a framerate cap for the UI.
Most implementations will only use this if vsync is disabled.
-
getUnfocusedFPS
final Integer getUnfocusedFPS()
set this to something other than 0 to change the framerate from the current maxFPS to this value when it is unfocused.
-
setUnfocusedFPS
final Unit setUnfocusedFPS(Integer unfocusedFPS)
set this to something other than 0 to change the framerate from the current maxFPS to this value when it is unfocused.
-
isVSyncEnabled
final Boolean isVSyncEnabled()
-
enableVSync
final Unit enableVSync(Boolean enableVSync)
-
getDefaultLocale
final String getDefaultLocale()
-
setDefaultLocale
final Unit setDefaultLocale(String defaultLocale)
-
getResourcePolicy
final Settings.ResourcePolicy getResourcePolicy()
How to handle resource (image and font) loading errors.
-
setResourcePolicy
final Unit setResourcePolicy(Settings.ResourcePolicy resourcePolicy)
How to handle resource (image and font) loading errors.
-
isMasterFrameBuffer
final Boolean isMasterFrameBuffer()
If true, the renderer will render all layout and component to a 'master' framebuffer, then every frame, render that.
- Since:
0.18.0
-
setMasterFrameBuffer
final Unit setMasterFrameBuffer(@ApiStatus.Experimental() Boolean isMasterFrameBuffer)
If true, the renderer will render all layout and component to a 'master' framebuffer, then every frame, render that.
- Since:
0.18.0
-
getMinDrawablesForFramebuffer
final Integer getMinDrawablesForFramebuffer()
minimum number of drawables in a group before it will use a framebuffer.
This value should be set to something relatively high, as the performance gain from using a framebuffer only works if there is a large amount of draw calls.
-
setMinDrawablesForFramebuffer
final Unit setMinDrawablesForFramebuffer(@ApiStatus.Experimental() Integer minDrawablesForFramebuffer)
minimum number of drawables in a group before it will use a framebuffer.
This value should be set to something relatively high, as the performance gain from using a framebuffer only works if there is a large amount of draw calls.
-
framebuffersEnabled
final Boolean framebuffersEnabled()
Enable or disable framebuffers. Please note that PolyUI is designed to work with framebuffers, so disabling them may cause performance issues.
- Since:
0.18.0
-
enableFramebuffers
final Unit enableFramebuffers(@ApiStatus.Experimental() Boolean framebuffersEnabled)
Enable or disable framebuffers. Please note that PolyUI is designed to work with framebuffers, so disabling them may cause performance issues.
- Since:
0.18.0
-
isRenderPausingEnabled
final Boolean isRenderPausingEnabled()
This optimization enables "render pausing", or allowing the renderer to pause rendering when there are no changes to the UI.
This requires a setup such as
if (polyUI.drew) glfwSwapBuffers(handle)in your main loop.- Since:
0.12.0
-
enableRenderPausing
final Unit enableRenderPausing(Boolean renderPausingEnabled)
This optimization enables "render pausing", or allowing the renderer to pause rendering when there are no changes to the UI.
This requires a setup such as
if (polyUI.drew) glfwSwapBuffers(handle)in your main loop.- Since:
0.12.0
-
getComboMaxInterval
final Long getComboMaxInterval()
the time between clicks for them to be considered as a combo.
-
setComboMaxInterval
final Unit setComboMaxInterval(Long comboMaxInterval)
the time between clicks for them to be considered as a combo.
-
getMaxComboSize
final Integer getMaxComboSize()
maximum amount of clicks that can be combo-ed in any interval
-
setMaxComboSize
final Unit setMaxComboSize(Integer maxComboSize)
maximum amount of clicks that can be combo-ed in any interval
-
enableComboClearing
final Boolean enableComboClearing()
if true, the combo will be cleared when it reaches maxComboSize. Otherwise, it will just continue to dispatch the max event for future clicks if they are within the combo frame.
-
shouldClearComboWhenMaxed
final Unit shouldClearComboWhenMaxed(Boolean clearComboWhenMaxed)
if true, the combo will be cleared when it reaches maxComboSize. Otherwise, it will just continue to dispatch the max event for future clicks if they are within the combo frame.
-
getDragThreshold
final Float getDragThreshold()
The threshold for a drag to be considered a 'drag', meaning the drag event will begin to be dispatched, in pixels.
- Since:
1.6.1
-
setDragThreshold
final Unit setDragThreshold(Float dragThreshold)
The threshold for a drag to be considered a 'drag', meaning the drag event will begin to be dispatched, in pixels.
- Since:
1.6.1
-
getScrollMultiplier
final Vec2 getScrollMultiplier()
Scroll multiplier factor, which will multiply the returned value of the callback by this value. First value is the X scroll multiplier, with the second being the Y scroll multiplier.
-
setScrollMultiplier
final Unit setScrollMultiplier(Vec2 scrollMultiplier)
Scroll multiplier factor, which will multiply the returned value of the callback by this value. First value is the X scroll multiplier, with the second being the Y scroll multiplier.
-
isNaturalScrolling
final Boolean isNaturalScrolling()
Weather to invert the scroll direction
-
enableNaturalScrolling
final Unit enableNaturalScrolling(Boolean naturalScrolling)
Weather to invert the scroll direction
-
getMinimumSize
final Vec2 getMinimumSize()
Set the minimum renderer size (width by height) that this instance can be resized to.
Set to
-1to disable an axis.- Since:
0.18.4
-
setMinimumSize
final Unit setMinimumSize(Vec2 minimumSize)
Set the minimum renderer size (width by height) that this instance can be resized to.
Set to
-1to disable an axis.- Since:
0.18.4
-
getMaximumSize
final Vec2 getMaximumSize()
Set the maximum renderer size (width by height) that this instance can be resized to.
Set to
-1to disable an axis.- Since:
0.18.4
-
setMaximumSize
final Unit setMaximumSize(Vec2 maximumSize)
Set the maximum renderer size (width by height) that this instance can be resized to.
Set to
-1to disable an axis.- Since:
0.18.4
-
getAspectRatio
final Pair<Integer, Integer> getAspectRatio()
Set the renderer aspect ratio, with the ratio being width:height, e.g.
16 to 9=16:9.While PolyUI will resize the content to this aspect ratio, if the renderer is not at this aspect ratio it may look odd (content smaller than the window). To prevent this, you must ensure that the window implementation is only allowing resizes to this aspect ratio.
Set to
-1to disable, or0to infer it automatically. Any other value is the aspect ratio.- Since:
0.18.4
-
setAspectRatio
final Unit setAspectRatio(Pair<Integer, Integer> aspectRatio)
Set the renderer aspect ratio, with the ratio being width:height, e.g.
16 to 9=16:9.While PolyUI will resize the content to this aspect ratio, if the renderer is not at this aspect ratio it may look odd (content smaller than the window). To prevent this, you must ensure that the window implementation is only allowing resizes to this aspect ratio.
Set to
-1to disable, or0to infer it automatically. Any other value is the aspect ratio.- Since:
0.18.4
-
willCleanupAfterInit
final Boolean willCleanupAfterInit()
This property will explicitly clean up after the initialization of PolyUI, calling the garbage collector to free up temporary objects created during initialization.
This option will usually halve or more the memory usage, but takes time (~10ms). It is recommended for memory limited scenarios and in production.
- Since:
0.20.0
-
enableInitCleanup
final Unit enableInitCleanup(Boolean cleanupAfterInit)
This property will explicitly clean up after the initialization of PolyUI, calling the garbage collector to free up temporary objects created during initialization.
This option will usually halve or more the memory usage, but takes time (~10ms). It is recommended for memory limited scenarios and in production.
- Since:
0.20.0
-
willCleanupOnShutdown
final Boolean willCleanupOnShutdown()
This property will run the cleanup() method in a shutdown hook which will free memory used by PolyUI.
- Since:
0.20.1
-
enableShutdownCleanup
final Unit enableShutdownCleanup(Boolean cleanupOnShutdown)
This property will run the cleanup() method in a shutdown hook which will free memory used by PolyUI.
- Since:
0.20.1
-
shouldLoadTranslationsOnInit
final Boolean shouldLoadTranslationsOnInit()
Set this to true to enable loading of translation keys upon startup, instead of the default behaviour of loading them when they are first used.
- Since:
0.21.1
-
enableTranslationLoadingOnInit
final Unit enableTranslationLoadingOnInit(Boolean loadTranslationsOnInit)
Set this to true to enable loading of translation keys upon startup, instead of the default behaviour of loading them when they are first used.
- Since:
0.21.1
-
forceSetsInitialSize
final Boolean forceSetsInitialSize()
This property will mean that, if
forceis true in theresizemethod, the initial size will be set to the size given.- Since:
1.1.63
-
enableForceSettingInitialSize
final Unit enableForceSettingInitialSize(Boolean forceSetsInitialSize)
This property will mean that, if
forceis true in theresizemethod, the initial size will be set to the size given.- Since:
1.1.63
-
-
-
-