com.jme.system
Interface GameSettings

All Known Implementing Classes:
AbstractGameSettings, BaseGame.BaseGameSettings, PreferencesGameSettings, PropertiesGameSettings

public interface GameSettings

GameSettings offers an abstraction from the internals of getting/setting settings for a game.

Author:
Matthew D. Hicks

Field Summary
static int DEFAULT_ALPHA_BITS
           
static int DEFAULT_DEPTH
          The default depth, used if there is a problem with the properties file.
static int DEFAULT_DEPTH_BITS
           
static int DEFAULT_FRAMERATE
           
static int DEFAULT_FREQUENCY
          The default frequency, used if there is a problem with the properties file.
static boolean DEFAULT_FULLSCREEN
          The default fullscreen flag, used if there is a problem with the properties file.
static int DEFAULT_HEIGHT
          The default height, used if there is a problem with the properties file.
static boolean DEFAULT_MUSIC
           
static java.lang.String DEFAULT_RENDERER
          The default renderer flag, used if there is a problem with the properties file.
static int DEFAULT_SAMPLES
           
static boolean DEFAULT_SFX
           
static int DEFAULT_STENCIL_BITS
           
static boolean DEFAULT_VERTICAL_SYNC
           
static int DEFAULT_WIDTH
          The default width, used if there is a problem with the properties file.
 
Method Summary
 void clear()
          Clears all settings.
 java.lang.String get(java.lang.String name, java.lang.String defaultValue)
           
 int getAlphaBits()
          Returns the alpha bits to use for the renderer as stored or the default.
 boolean getBoolean(java.lang.String name, boolean defaultValue)
           
 byte[] getByteArray(java.lang.String name, byte[] bytes)
           
 java.lang.String getDefaultSettingsWidgetImage()
           
 int getDepth()
          Returns the depth for the screen as stored or the default.
 int getDepthBits()
          Returns the depth bits to use for the renderer as stored or the default.
 double getDouble(java.lang.String name, double defaultValue)
           
 float getFloat(java.lang.String name, float defaultValue)
           
 int getFramerate()
          Returns the specified framerate or -1 if variable framerate is specified.
 int getFrequency()
          Returns the screen refresh frequency as stored or the default.
 int getHeight()
          Returns the height for the screen as stored or the default.
 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 obj)
           
 java.lang.String getRenderer()
          Returns the stored rendering API name, or the default
 int getSamples()
          Returns the number of samples to use for the multisample buffer as stored or the default.
 int getStencilBits()
          Returns the stencil bits to use for the renderer as stored or the default.
 int getWidth()
          Returns the width for the screen as stored or the default.
 boolean isFullscreen()
          Returns the screen's fullscreen status as stored or the default.
 boolean isMusic()
          Returns the enabled status of music as stored or the default.
 boolean isNew()
           
 boolean isSFX()
          Returns the enabled status of sound effects as stored or the default.
 boolean isVerticalSync()
          Returns the current state of vertical synchronization.
 void save()
          This method will persist all changed settings.
 void set(java.lang.String name, java.lang.String value)
           
 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[] bytes)
           
 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 frequency)
          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 musicEnabled)
          Sets the enabled status of music.
 void setObject(java.lang.String name, java.lang.Object obj)
           
 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 sfxEnabled)
          Sets the enabled status of sound effects.
 void setStencilBits(int stencilBits)
          Sets the stencil bits for use with the renderer.
 void setVerticalSync(boolean vsync)
          Sets the state of vertical synchronization.
 void setWidth(int width)
          Sets the width for the screen.
 

Field Detail

DEFAULT_WIDTH

static final int DEFAULT_WIDTH
The default width, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_HEIGHT

static final int DEFAULT_HEIGHT
The default height, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_DEPTH

static final int DEFAULT_DEPTH
The default depth, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_FREQUENCY

static final int DEFAULT_FREQUENCY
The default frequency, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_FULLSCREEN

static final boolean DEFAULT_FULLSCREEN
The default fullscreen flag, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_RENDERER

static final java.lang.String DEFAULT_RENDERER
The default renderer flag, used if there is a problem with the properties file.

See Also:
Constant Field Values

DEFAULT_VERTICAL_SYNC

static final boolean DEFAULT_VERTICAL_SYNC
See Also:
Constant Field Values

DEFAULT_DEPTH_BITS

static final int DEFAULT_DEPTH_BITS
See Also:
Constant Field Values

DEFAULT_ALPHA_BITS

static final int DEFAULT_ALPHA_BITS
See Also:
Constant Field Values

DEFAULT_STENCIL_BITS

static final int DEFAULT_STENCIL_BITS
See Also:
Constant Field Values

DEFAULT_SAMPLES

static final int DEFAULT_SAMPLES
See Also:
Constant Field Values

DEFAULT_MUSIC

static final boolean DEFAULT_MUSIC
See Also:
Constant Field Values

DEFAULT_SFX

static final boolean DEFAULT_SFX
See Also:
Constant Field Values

DEFAULT_FRAMERATE

static final int DEFAULT_FRAMERATE
See Also:
Constant Field Values
Method Detail

getDefaultSettingsWidgetImage

java.lang.String getDefaultSettingsWidgetImage()

getRenderer

java.lang.String getRenderer()
Returns the stored rendering API name, or the default

Returns:
String

setRenderer

void setRenderer(java.lang.String renderer)
Sets the rendering API.

Parameters:
renderer -

getWidth

int getWidth()
Returns the width for the screen as stored or the default.

Returns:
int

setWidth

void setWidth(int width)
Sets the width for the screen.

Parameters:
width -

getHeight

int getHeight()
Returns the height for the screen as stored or the default.

Returns:
int

setHeight

void setHeight(int height)
Sets the height for the screen.

Parameters:
height -

getDepth

int getDepth()
Returns the depth for the screen as stored or the default.

Returns:
int

setDepth

void setDepth(int depth)
Sets the depth for the screen.

Parameters:
depth -

getFrequency

int getFrequency()
Returns the screen refresh frequency as stored or the default.

Returns:
int

setFrequency

void setFrequency(int frequency)
Sets the screen refresh frequency.

Parameters:
frequency -

isVerticalSync

boolean isVerticalSync()
Returns the current state of vertical synchronization. This synchronizes the game update frequency to the monitor update frequency. This can help provide a much smoother game experience and help with screen tearing.

Returns:
boolean

setVerticalSync

void setVerticalSync(boolean vsync)
Sets the state of vertical synchronization. This synchronizes the game update frequency to the monitor update frequency. This can help provide a much smoother game experience and help with screen tearing.

Parameters:
vsync -

isFullscreen

boolean isFullscreen()
Returns the screen's fullscreen status as stored or the default.

Returns:
boolean

setFullscreen

void setFullscreen(boolean fullscreen)
Sets the fullscreen status for the screen.

Parameters:
fullscreen -

getDepthBits

int getDepthBits()
Returns the depth bits to use for the renderer as stored or the default.

Returns:
int

setDepthBits

void setDepthBits(int depthBits)
Sets the depth bits for use with the renderer.

Parameters:
depthBits -

getAlphaBits

int getAlphaBits()
Returns the alpha bits to use for the renderer as stored or the default.

Returns:
int

setAlphaBits

void setAlphaBits(int alphaBits)
Sets the alpha bits for use with the renderer.

Parameters:
alphaBits -

getStencilBits

int getStencilBits()
Returns the stencil bits to use for the renderer as stored or the default.

Returns:
int

setStencilBits

void setStencilBits(int stencilBits)
Sets the stencil bits for use with the renderer.

Parameters:
stencilBits -

getSamples

int getSamples()
Returns the number of samples to use for the multisample buffer as stored or the default.

Returns:
int

setSamples

void setSamples(int samples)
Sets the number of samples to use for the multisample buffer.

Parameters:
samples -

isMusic

boolean isMusic()
Returns the enabled status of music as stored or the default.

Returns:
boolean

setMusic

void setMusic(boolean musicEnabled)
Sets the enabled status of music.

Parameters:
musicEnabled -

isSFX

boolean isSFX()
Returns the enabled status of sound effects as stored or the default.

Returns:
boolean

setSFX

void setSFX(boolean sfxEnabled)
Sets the enabled status of sound effects.

Parameters:
sfxEnabled -

getFramerate

int getFramerate()
Returns the specified framerate or -1 if variable framerate is specified.

Returns:
int

setFramerate

void setFramerate(int framerate)
Sets the framerate. Use -1 to specify variable framerate.

Parameters:
framerate -

clear

void clear()
           throws java.io.IOException
Clears all settings.

This removes all settings. As a result, get*() will return the default value, but this is very different from setting default values. If all settings are removed, users will automatically receive updated system or game default settings. If a user were to set (then save) default values, they would always retrieve those values regardless to any changes to defaults.

clear() followed by save() will persist an indication that there are no values saved.

Throws:
java.io.IOException - If there is some consistency or access problem obtaining the values to be cleared.
See Also:
save()

set

void set(java.lang.String name,
         java.lang.String value)

setBoolean

void setBoolean(java.lang.String name,
                boolean value)

setInt

void setInt(java.lang.String name,
            int value)

setLong

void setLong(java.lang.String name,
             long value)

setFloat

void setFloat(java.lang.String name,
              float value)

setDouble

void setDouble(java.lang.String name,
               double value)

setByteArray

void setByteArray(java.lang.String name,
                  byte[] bytes)

setObject

void setObject(java.lang.String name,
               java.lang.Object obj)

get

java.lang.String get(java.lang.String name,
                     java.lang.String defaultValue)

getBoolean

boolean getBoolean(java.lang.String name,
                   boolean defaultValue)

getInt

int getInt(java.lang.String name,
           int defaultValue)

getLong

long getLong(java.lang.String name,
             long defaultValue)

getFloat

float getFloat(java.lang.String name,
               float defaultValue)

getDouble

double getDouble(java.lang.String name,
                 double defaultValue)

getByteArray

byte[] getByteArray(java.lang.String name,
                    byte[] bytes)

getObject

java.lang.Object getObject(java.lang.String name,
                           java.lang.Object obj)

isNew

boolean isNew()

save

void save()
          throws java.io.IOException
This method will persist all changed settings. For backing implementations which automatically persist all value changes immediately, this method should re-persist the settings.

A call to save() when the GameSettings holds no settings should persist something showing that no settings are saved for this game. (As opposed to saving nothing at all, or removing all traces of these GameSettings).

Throws:
java.io.IOException