Class Config
java.lang.Object
dev.prozilla.pine.core.state.config.Config
Manages configuration of the application.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ConfigOption
<String> final ConfigOption
<Boolean> Determines whether depth values will be recalculated when new entities are added to the world.final ConfigOption
<Integer> Target frames per second.final LogConfig
Options related to logging.final RenderConfig
Options related to rendering.final WindowConfig
Options related to the application window. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> void
addOption
(ConfigKey<T> key, ConfigOption<T> option) Adds a new config option with a given key.void
Copies all options from another config.<T> void
Copies an option with a given key from another config.void
copyFrom
(Config otherConfig, Collection<ConfigKey<?>> keys) Copies all options from another config based on a collection of keys.Collection
<ConfigKey<?>> getKeys()
<T> T
Returns the value of an option.Returns the collection of options in this configuration.boolean
Checks whether this config has an option with a given key.void
reset()
Resets all config options to their initial values.void
resetOption
(ConfigKey<?> key) Resets an option to its initial value.<T> void
Sets the value of an option.
-
Field Details
-
FPS
-
ENABLE_DEPTH_RECALCULATION
-
DEFAULT_FONT_PATH
-
fps
Target frames per second. When set to0
, fps is uncapped. Defaults to120
. -
enableDepthRecalculation
Determines whether depth values will be recalculated when new entities are added to the world. Defaults totrue
. -
defaultFontPath
-
rendering
Options related to rendering. -
logging
Options related to logging. -
window
Options related to the application window.
-
-
Constructor Details
-
Method Details
-
addOption
Adds a new config option with a given key.- Type Parameters:
T
- Type of the option- Parameters:
key
- Key of the config optionoption
- Config option- Throws:
IllegalStateException
- Ifkey
is already associated with an option.
-
hasOption
Checks whether this config has an option with a given key.- Parameters:
key
- Key of the option
-
getOption
Returns the value of an option.- Type Parameters:
T
- Type of the option- Parameters:
key
- Key of the config option- Returns:
- Value of the option associated with
key
-
setOption
Sets the value of an option.- Type Parameters:
T
- Type of the option- Parameters:
key
- Key of the config optionvalue
- New value for the option associated withkey
- Throws:
IllegalArgumentException
- If the option has a validator that evaluates tofalse
forvalue
.
-
resetOption
Resets an option to its initial value.- Parameters:
key
- Key of the config option
-
getKeys
-
getOptions
Returns the collection of options in this configuration. -
copyFrom
Copies all options from another config.- Parameters:
otherConfig
- Config to copy from
-
copyFrom
Copies all options from another config based on a collection of keys.- Parameters:
otherConfig
- The config to copy fromkeys
- The keys of the options to copy
-
copyFrom
Copies an option with a given key from another config.- Parameters:
otherConfig
- Config to copy fromkey
- Key of the option to copy
-
reset
public void reset()Resets all config options to their initial values.
-