Class Config
java.lang.Object
dev.prozilla.pine.core.state.config.Config
Manages configuration of the application.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringConfigOptionThe name of the application.final BooleanConfigOptionEnables the automatic creation of directories.final StringConfigOptionThe name of the company behind the application.final StringConfigOptionDefault font used to render text elements.final BooleanConfigOptionDetermines whether depth values will be recalculated when new entities are added to the world.final IntConfigOptionTarget frames per second.final LogConfigOptions related to logging.final RenderConfigOptions related to rendering.final StorageConfigOptions related to storage.final WindowConfigOptions related to the application window. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddOption(ConfigKey<T> key, ConfigOption<T> option) Adds a new config option with a given key.voidCopies all options from another config.<T> voidCopies an option with a given key from another config.voidcopyFrom(Config otherConfig, Collection<ConfigKey<?>> keys) Copies all options from another config based on a collection of keys.Collection<ConfigKey<?>> getKeys()<T> TReturns the value of an option.Returns the collection of options in this configuration.booleanChecks whether this config has an option with a given key.voidremoveOption(ConfigKey<?> key) voidreset()Resets all config options to their initial values.voidresetOption(ConfigKey<?> key) Resets an option to its initial value.<T> voidSets the value of an option.<T> void
-
Field Details
-
FPS
-
ENABLE_DEPTH_RECALCULATION
-
DEFAULT_FONT_PATH
-
COMPANY_NAME
-
APP_NAME
-
AUTO_CREATE_DIRECTORIES
-
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
Default font used to render text elements. Defaults tonull. -
companyName
The name of the company behind the application. Defaults tonull. -
appName
The name of the application. Defaults to"Untitled". -
autoCreateDirectories
Enables the automatic creation of directories. Defaults totrue. -
rendering
Options related to rendering. -
logging
Options related to logging. -
window
Options related to the application window. -
storage
Options related to storage.
-
-
Constructor Details
-
Config
public Config() -
Config
-
-
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- Ifkeyis already associated with an option.
-
removeOption
- Throws:
IllegalStateException
-
hasOption
Checks whether this config has an option with a given key.- Parameters:
key- Key of the option
-
getOption
-
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
-
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 tofalseforvalue.
-
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.
-