|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.system.AbstractGameSettings
com.jme.system.PropertiesGameSettings
public class PropertiesGameSettings
PropertiesGameSettings
handles loading and saving a properties
file that
defines the display settings. A property file is identified during creation
of the object. The properties file should have the following format:
FREQ=60
RENDERER=LWJGL
WIDTH=1280
HEIGHT=1024
DEPTH=32
FULLSCREEN=false
Field Summary |
---|
Fields inherited from class com.jme.system.AbstractGameSettings |
---|
defaultAlphaBits, defaultDepth, defaultDepthBits, defaultFramerate, defaultFrequency, defaultFullscreen, defaultHeight, defaultMusic, defaultRenderer, defaultSamples, defaultSettingsWidgetImage, defaultSFX, defaultStencilBits, defaultVerticalSync, defaultWidth, isNew |
Fields inherited from interface com.jme.system.GameSettings |
---|
DEFAULT_ALPHA_BITS, DEFAULT_DEPTH, DEFAULT_DEPTH_BITS, DEFAULT_FRAMERATE, DEFAULT_FREQUENCY, DEFAULT_FULLSCREEN, DEFAULT_HEIGHT, DEFAULT_MUSIC, DEFAULT_RENDERER, DEFAULT_SAMPLES, DEFAULT_SFX, DEFAULT_STENCIL_BITS, DEFAULT_VERTICAL_SYNC, DEFAULT_WIDTH |
Constructor Summary | |
---|---|
PropertiesGameSettings(java.lang.String userFile)
Legacy wrapper constructor |
|
PropertiesGameSettings(java.lang.String personalFilename,
java.lang.String dfltsFilename)
Constructor creates the PropertiesGameSettings object for use. |
Method Summary | |
---|---|
void |
clear()
Clears all settings. |
java.lang.String |
get(java.lang.String key)
get takes an arbitrary string as a key and returns any
value associated with it, null if none. |
java.lang.String |
get(java.lang.String name,
java.lang.String defaultValue)
|
int |
getAlphaBits()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
boolean |
getBoolean(java.lang.String name,
boolean defaultValue)
|
byte[] |
getByteArray(java.lang.String name,
byte[] defaultValue)
|
int |
getDepth()
getDepth returns the depth as read from the properties
file. |
int |
getDepthBits()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
double |
getDouble(java.lang.String name,
double defaultValue)
|
float |
getFloat(java.lang.String name,
float defaultValue)
|
int |
getFramerate()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
int |
getFreq()
Deprecated. Use method getFrequency instead. |
int |
getFrequency()
getFrequency returns the frequency of the monitor as read from
the properties file. |
boolean |
getFullscreen()
Deprecated. Use method isFullscreen instead. |
int |
getHeight()
getHeight returns the height as read from the properties
file. |
int |
getInt(java.lang.String name,
int defaultValue)
|
long |
getLong(java.lang.String name,
long defaultValue)
|
java.lang.Object |
getObject(java.lang.String name,
java.lang.Object defaultValue)
|
java.lang.String |
getRenderer()
getRenderer returns the requested rendering API, or the
default. |
int |
getSamples()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
int |
getStencilBits()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
int |
getWidth()
getWidth returns the width as read from the properties
file. |
boolean |
isFullscreen()
isFullscreen returns the fullscreen flag as read from the
properties file. |
boolean |
isMusic()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
boolean |
isSFX()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
boolean |
isVerticalSync()
If the properties file does not contain the setting or was not read properly, the default value is returned. |
boolean |
load()
load attempts to load the properties file defined during
instantiation and put all properties in the table. |
void |
remove(java.lang.String name)
Removes specified property, if present. |
void |
save()
Persists current property mappings to designated file, overwriting if file already present. |
boolean |
save(int width,
int height,
int depth,
int freq,
boolean fullscreen,
java.lang.String renderer)
Deprecated. |
void |
set(java.lang.String name,
java.lang.String value)
Sets a property. |
void |
setAlphaBits(int alphaBits)
Sets the alpha bits for use with the renderer. |
void |
setBoolean(java.lang.String name,
boolean value)
|
void |
setByteArray(java.lang.String name,
byte[] value)
|
void |
setDepth(int depth)
Sets the depth for the screen. |
void |
setDepthBits(int depthBits)
Sets the depth bits for use with the renderer. |
void |
setDouble(java.lang.String name,
double value)
|
void |
setFloat(java.lang.String name,
float value)
|
void |
setFramerate(int framerate)
Sets the framerate. |
void |
setFrequency(int freq)
Sets the screen refresh frequency. |
void |
setFullscreen(boolean fullscreen)
Sets the fullscreen status for the screen. |
void |
setHeight(int height)
Sets the height for the screen. |
void |
setInt(java.lang.String name,
int value)
|
void |
setLong(java.lang.String name,
long value)
|
void |
setMusic(boolean music)
Sets the enabled status of music. |
void |
setObject(java.lang.String name,
java.lang.Object value)
Not implemented. |
void |
setRenderer(java.lang.String renderer)
Sets the rendering API. |
void |
setSamples(int samples)
Sets the number of samples to use for the multisample buffer. |
void |
setSFX(boolean sfx)
Sets the enabled status of sound effects. |
void |
setStencilBits(int stencilBits)
Sets the stencil bits for use with the renderer. |
void |
setVerticalSync(boolean verticalSync)
Sets the state of vertical synchronization. |
void |
setWidth(int width)
Sets the width for the screen. |
void |
wrappedSave()
save() method which throws only a RuntimeExceptin. |
Methods inherited from class com.jme.system.AbstractGameSettings |
---|
assignDefaults, getDefaultSettingsWidgetImage, isNew, loadBoolean, loadInteger, normalizeName, setIsNew |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesGameSettings(java.lang.String userFile)
PropertiesGameSettings(String, String)
public PropertiesGameSettings(java.lang.String personalFilename, java.lang.String dfltsFilename)
PropertiesGameSettings
object for use.
personalFilename
- the properties file to use, read from filesystem.
Must not be null.dfltsFilename
- the properties file to use, read from CLASSPATH.
Null to not seek any runtime defaults file.
JmeException
- if the personalFilename is null.Method Detail |
---|
public boolean load()
load
attempts to load the properties file defined during
instantiation and put all properties in the table. If there is a problem
loading or reading the file, false is returned. If all goes well, true is
returned.
public void save() throws java.io.IOException
java.io.IOException
- for I/O failurespublic boolean save(int width, int height, int depth, int freq, boolean fullscreen, java.lang.String renderer)
save(int, int, int, int, boolean, String)
overwrites the properties file with the given parameters.
width
- the width of the resolution.height
- the height of the resolution.depth
- the bits per pixel.freq
- the frequency of the monitor.fullscreen
- use fullscreen or not.
public int getWidth()
getWidth
returns the width as read from the properties
file. If the properties file does not contain width or was not read
properly, the default width is returned.
public int getHeight()
getHeight
returns the height as read from the properties
file. If the properties file does not contain height or was not read
properly, the default height is returned.
public int getDepth()
getDepth
returns the depth as read from the properties
file. If the properties file does not contain depth or was not read
properly, the default depth is returned.
public int getFrequency()
getFrequency
returns the frequency of the monitor as read from
the properties file. If the properties file does not contain frequency
or was not read properly the default frequency is returned.
GameSettings.getFrequency()
public boolean isFullscreen()
isFullscreen
returns the fullscreen flag as read from the
properties file. If the properties file does not contain the fullscreen
flag or was not read properly, the default value is returned.
PreferencesGameSettings.isFullscreen()
public java.lang.String getRenderer()
getRenderer
returns the requested rendering API, or the
default.
public java.lang.String get(java.lang.String key)
get
takes an arbitrary string as a key and returns any
value associated with it, null if none.
key
- the key to use for data retrieval.
public void clear()
GameSettings
GameSettings.clear()
public java.lang.String get(java.lang.String name, java.lang.String defaultValue)
GameSettings.get(String, String)
public int getAlphaBits()
java.lang.InternalError
- in all casesGameSettings.getAlphaBits()
public int getDepthBits()
java.lang.InternalError
- in all casesGameSettings.getDepthBits()
public int getFramerate()
java.lang.InternalError
- in all casesGameSettings.getFramerate()
public int getSamples()
java.lang.InternalError
- in all casesGameSettings.getSamples()
public int getStencilBits()
java.lang.InternalError
- in all casesGameSettings.getStencilBits()
public boolean isMusic()
java.lang.InternalError
- in all casesGameSettings.isMusic()
public boolean isSFX()
java.lang.InternalError
- in all casesGameSettings.isSFX()
public boolean isVerticalSync()
java.lang.InternalError
- in all casesGameSettings.isVerticalSync()
public int getFreq()
getFrequency()
public boolean getFullscreen()
isFullscreen()
public boolean getBoolean(java.lang.String name, boolean defaultValue)
GameSettings.getBoolean(String, boolean)
public byte[] getByteArray(java.lang.String name, byte[] defaultValue)
GameSettings.getByteArray(String, byte[])
public double getDouble(java.lang.String name, double defaultValue)
GameSettings.getDouble(String, double)
public float getFloat(java.lang.String name, float defaultValue)
GameSettings.getFloat(String, float)
public int getInt(java.lang.String name, int defaultValue)
GameSettings.getInt(String, int)
public long getLong(java.lang.String name, long defaultValue)
GameSettings.getLong(String, long)
public java.lang.Object getObject(java.lang.String name, java.lang.Object defaultValue)
GameSettings.getObject(String, Object)
public void remove(java.lang.String name)
public void set(java.lang.String name, java.lang.String value)
GameSettings.set(String, String)
public void wrappedSave()
RuntimeSetting
- for IO failuresave()
public void setBoolean(java.lang.String name, boolean value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setBoolean(String, boolean)
public void setByteArray(java.lang.String name, byte[] value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setByteArray(String, byte[])
public void setDouble(java.lang.String name, double value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setDouble(String, double)
public void setFloat(java.lang.String name, float value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setFloat(String, float)
public void setInt(java.lang.String name, int value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setInt(String, int)
public void setLong(java.lang.String name, long value)
RuntimeSetting
- for IO failureset(String, String)
,
PreferencesGameSettings.setLong(String, long)
public void setObject(java.lang.String name, java.lang.Object value)
java.lang.InternalError
- in all casesPreferencesGameSettings#setObject(String, boolean)
,
set(String, String)
public void setWidth(int width)
GameSettings
GameSettings.setWidth(int)
public void setHeight(int height)
GameSettings
GameSettings.setHeight(int)
public void setDepth(int depth)
GameSettings
GameSettings.setDepth(int)
public void setFrequency(int freq)
GameSettings
GameSettings.setFrequency(int)
public void setFullscreen(boolean fullscreen)
GameSettings
GameSettings.setFullscreen(boolean)
public void setRenderer(java.lang.String renderer)
GameSettings
GameSettings.setRenderer(String)
public void setAlphaBits(int alphaBits)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setAlphaBits(int)
public void setDepthBits(int depthBits)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setDepthBits(int)
public void setFramerate(int framerate)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setFramerate(int)
public void setMusic(boolean music)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setMusic(boolean)
public void setSamples(int samples)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setSamples(int)
public void setSFX(boolean sfx)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setSFX(boolean)
public void setStencilBits(int stencilBits)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setStencilBits(int)
public void setVerticalSync(boolean verticalSync)
GameSettings
java.lang.InternalError
- in all casesGameSettings.setVerticalSync(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |