Class AbstractCVarSystem
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.cvar.AbstractCVarSystem
-
- Direct Known Subclasses:
CVarSystemMap
,CVarSystemRoot
,CVarSystemSave
public abstract class AbstractCVarSystem extends java.lang.Object
Each cvar system manages one file. Cvars get registered first and then overwritten by the local file. If a cvar is in the file but not registered it gets ignored.
-
-
Constructor Summary
Constructors Constructor Description AbstractCVarSystem(java.io.File path)
you have to manually callload()
to load from path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
saves the cvars with the flag to fileCVar
get(java.lang.String cvar)
java.util.ArrayList<java.lang.String>
getSuggestions(java.lang.String prefix)
Good use is auto-complete suggestions.boolean
getValueB(java.lang.String cvar)
float
getValueF(java.lang.String cvar)
int
getValueI(java.lang.String cvar)
java.lang.String
getValueS(java.lang.String cvar)
void
load()
load CVars from file and overwrite engine cvars.void
register(CVar cvar, java.lang.String name)
Registering should only be done by the game or the engine in init phase.void
register(CVar cvar, java.lang.String name, CVarFlags flag)
Registering should only be done by the game or the engine in init phase.void
save()
saves CVars to filejava.lang.String
showAll()
-
-
-
Constructor Detail
-
AbstractCVarSystem
public AbstractCVarSystem(java.io.File path)
you have to manually callload()
to load from path.- Parameters:
path
- path to the .cvar file
-
-
Method Detail
-
get
public CVar get(java.lang.String cvar)
- Parameters:
cvar
- can include a path- Returns:
-
getValueB
public boolean getValueB(java.lang.String cvar)
- Parameters:
cvar
-- Returns:
-
getValueI
public int getValueI(java.lang.String cvar)
- Parameters:
cvar
-- Returns:
-
getValueF
public float getValueF(java.lang.String cvar)
- Parameters:
cvar
-- Returns:
-
getValueS
public java.lang.String getValueS(java.lang.String cvar)
- Parameters:
cvar
-- Returns:
-
load
public void load()
load CVars from file and overwrite engine cvars. You must register the cvars first before the values can be read.- Since:
- v1.4.2
-
dispose
public void dispose()
saves the cvars with the flag to file- Since:
- v1.4.2
-
save
public void save()
saves CVars to file
-
getSuggestions
public java.util.ArrayList<java.lang.String> getSuggestions(java.lang.String prefix)
Good use is auto-complete suggestions.- Parameters:
prefix
- some chars with which the cvar begins.- Returns:
- A list containing every cvar starting with the prefix
-
register
public void register(CVar cvar, java.lang.String name, CVarFlags flag)
Registering should only be done by the game or the engine in init phase. Also saves as defaultValue. if already registered updates the default and current value.- Parameters:
cvar
-name
-flag
-- Since:
- v1.4.2
-
register
public void register(CVar cvar, java.lang.String name)
Registering should only be done by the game or the engine in init phase. Also saves as defaultValue. if already registered updates the default and current value.
UsesCVarFlags.ARCHIVE
- Parameters:
cvar
-name
-- Since:
- v1.4.2
-
showAll
public java.lang.String showAll()
- Returns:
-
-