|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<java.lang.String,java.lang.Object>
com.jme3.system.AppSettings
public final class AppSettings
AppSettings
provides a store of configuration
to be used by the application.
By default only the context
uses the configuration,
however the user may set and retrieve the settings as well.
The settings can be stored either in the Java preferences
(using save(java.lang.String)
or
a .properties file (using save(java.io.OutputStream)
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Field Summary | |
---|---|
static java.lang.String |
LWJGL_OPENAL
Use the LWJGL OpenAL based renderer for audio capabilities. |
static java.lang.String |
LWJGL_OPENGL_ANY
Use LWJGL as the display system and allow the context to choose an appropriate renderer based on system capabilities. |
static java.lang.String |
LWJGL_OPENGL1
Use LWJGL as the display system and force using the OpenGL1.1 renderer. |
static java.lang.String |
LWJGL_OPENGL2
Use LWJGL as the display system and force using the OpenGL2.0 renderer. |
static java.lang.String |
LWJGL_OPENGL3
Use LWJGL as the display system and force using the core OpenGL3.3 renderer. |
Constructor Summary | |
---|---|
AppSettings(boolean loadDefaults)
Create a new instance of AppSettings . |
Method Summary | |
---|---|
void |
copyFrom(AppSettings other)
Copies all settings from other to this
AppSettings. |
java.lang.String |
getAudioRenderer()
Get the audio renderer |
int |
getBitsPerPixel()
Get the bits per pixel |
boolean |
getBoolean(java.lang.String key)
Get a boolean from the settings. |
int |
getDepthBits()
Get the number of depth bits |
float |
getFloat(java.lang.String key)
Get a float from the settings. |
int |
getFrameRate()
Get the framerate. |
int |
getFrequency()
Get the frequency |
int |
getHeight()
Get the height |
java.lang.Object[] |
getIcons()
Get the icon array |
int |
getInteger(java.lang.String key)
Get an integer from the settings. |
java.lang.String |
getRenderer()
Get the renderer |
int |
getSamples()
Get the number of samples |
java.lang.String |
getSettingsDialogImage()
Get the settings dialog image |
int |
getStencilBits()
Get the number of stencil bits |
java.lang.String |
getString(java.lang.String key)
Get a string from the settings. |
java.lang.String |
getTitle()
Get the application title |
int |
getWidth()
Get the width |
boolean |
isEmulateMouse()
Returns true if mouse emulation is enabled, false otherwise. |
boolean |
isEmulateMouseFlipX()
|
boolean |
isEmulateMouseFlipY()
|
boolean |
isFullscreen()
Get the fullscreen state |
boolean |
isVSync()
Get the vsync state |
void |
load(java.io.InputStream in)
Loads the settings from the given properties input stream. |
void |
load(java.lang.String preferencesKey)
Loads settings previously saved in the Java preferences. |
void |
mergeFrom(AppSettings other)
Same as copyFrom(com.jme3.system.AppSettings) , except
doesn't overwrite settings that are already set. |
void |
putBoolean(java.lang.String key,
boolean value)
Set a boolean on the settings. |
void |
putFloat(java.lang.String key,
float value)
Set a float on the settings. |
void |
putInteger(java.lang.String key,
int value)
Set an integer on the settings. |
void |
putString(java.lang.String key,
java.lang.String value)
Set a string on the settings. |
void |
save(java.io.OutputStream out)
Saves all settings to the given properties output stream. |
void |
save(java.lang.String preferencesKey)
Saves settings into the Java preferences. |
void |
setAudioRenderer(java.lang.String audioRenderer)
Set the audio renderer to use. |
void |
setBitsPerPixel(int value)
Set the bits per pixel for the display. |
void |
setCustomRenderer(java.lang.Class<? extends JmeContext> clazz)
Set a custom graphics renderer to use. |
void |
setDepthBits(int value)
Sets the number of depth bits to use. |
void |
setEmulateMouse(boolean emulateMouse)
Enable or disable mouse emulation on touchscreen based devices. |
void |
setEmulateMouseFlipAxis(boolean flipX,
boolean flipY)
Specify if the X or Y (or both) axes should be flipped for emulated mouse. |
void |
setFrameRate(int frameRate)
|
void |
setFrequency(int value)
Set the frequency, also known as refresh rate, for the rendering display. |
void |
setFullscreen(boolean value)
|
void |
setHeight(int value)
|
void |
setIcons(java.lang.Object[] value)
Sets the application icons to be used, with the most preferred first. |
void |
setRenderer(java.lang.String renderer)
Set the graphics renderer to use, one of: AppSettings.LWJGL_OPENGL1 - Force OpenGL1.1 compatability AppSettings.LWJGL_OPENGL2 - Force OpenGL2 compatability AppSettings.LWJGL_OPENGL3 - Force OpenGL3.3 compatability AppSettings.LWJGL_OPENGL_ANY - Choose an appropriate OpenGL version based on system capabilities null - Disable graphics rendering |
void |
setResolution(int width,
int height)
Set the resolution for the rendering display |
void |
setSamples(int value)
Set the number of samples per pixel. |
void |
setSettingsDialogImage(java.lang.String path)
Sets the path of the settings dialog image to use. |
void |
setStencilBits(int value)
Set the number of stencil bits. |
void |
setStereo3D(boolean value)
Enable 3D stereo. |
void |
setTitle(java.lang.String title)
|
void |
setUseInput(boolean use)
|
void |
setUseJoysticks(boolean use)
|
void |
setVSync(boolean value)
Set to true to enable vertical-synchronization, limiting and synchronizing every frame rendered to the monitor's refresh rate. |
void |
setWidth(int value)
|
boolean |
useInput()
Get the use input state. |
boolean |
useJoysticks()
Get the use joysticks state |
boolean |
useStereo3D()
Get the stereo 3D state |
Methods inherited from class java.util.HashMap |
---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Field Detail |
---|
public static final java.lang.String LWJGL_OPENGL1
setRenderer(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String LWJGL_OPENGL2
If the underlying system does not support OpenGL2.0, then the context initialization will throw an exception.
setRenderer(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String LWJGL_OPENGL3
If the underlying system does not support OpenGL3.3, then the context initialization will throw an exception. Note that currently jMonkeyEngine does not have any shaders that support OpenGL3.3 therefore this option is not useful.
setRenderer(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String LWJGL_OPENGL_ANY
If the GPU supports OpenGL2 or later, then the OpenGL2.0 renderer will be used, otherwise, the OpenGL1.1 renderer is used.
setRenderer(java.lang.String)
,
Constant Field Valuespublic static final java.lang.String LWJGL_OPENAL
setAudioRenderer(java.lang.String)
,
Constant Field ValuesConstructor Detail |
---|
public AppSettings(boolean loadDefaults)
AppSettings
.
If loadDefaults
is true, then the default settings
will be set on the AppSettings.
Use false if you want to change some settings but you would like the
application to load settings from previous launches.
loadDefaults
- If default settings are to be loaded.Method Detail |
---|
public void copyFrom(AppSettings other)
other
to this
AppSettings.
Any settings that are specified in other will overwrite settings set on this AppSettings.
other
- The AppSettings to copy the settings frompublic void mergeFrom(AppSettings other)
copyFrom(com.jme3.system.AppSettings)
, except
doesn't overwrite settings that are already set.
other
- The AppSettings to merge the settings frompublic void load(java.io.InputStream in) throws java.io.IOException
in
- The InputStream to load from
java.io.IOException
- If an IOException occurssave(java.io.OutputStream)
public void save(java.io.OutputStream out) throws java.io.IOException
out
- The OutputStream to write to
java.io.IOException
- If an IOException occursload(java.io.InputStream)
public void load(java.lang.String preferencesKey) throws java.util.prefs.BackingStoreException
preferencesKey
- The preferencesKey previously used to save the settings.
java.util.prefs.BackingStoreException
- If an exception occurs with the preferencessave(java.lang.String)
public void save(java.lang.String preferencesKey) throws java.util.prefs.BackingStoreException
On the Windows operating system, the preferences are saved in the registry
at the following key:
HKEY_CURRENT_USER\Software\JavaSoft\Prefs\[preferencesKey]
preferencesKey
- The preferences key to save at. Generally the
application's unique name.
java.util.prefs.BackingStoreException
- If an exception occurs with the preferencespublic int getInteger(java.lang.String key)
If the key is not set, then 0 is returned.
public boolean getBoolean(java.lang.String key)
If the key is not set, then false is returned.
public java.lang.String getString(java.lang.String key)
If the key is not set, then null is returned.
public float getFloat(java.lang.String key)
If the key is not set, then 0.0 is returned.
public void putInteger(java.lang.String key, int value)
public void putBoolean(java.lang.String key, boolean value)
public void putString(java.lang.String key, java.lang.String value)
public void putFloat(java.lang.String key, float value)
public void setEmulateMouse(boolean emulateMouse)
emulateMouse
- If mouse emulation should be enabled.public boolean isEmulateMouse()
public void setEmulateMouseFlipAxis(boolean flipX, boolean flipY)
flipX
- Set to flip X axisflipY
- Set to flip Y axissetEmulateMouse(boolean)
public boolean isEmulateMouseFlipX()
public boolean isEmulateMouseFlipY()
public void setFrameRate(int frameRate)
frameRate
- The frame-rate is the upper limit on how high
the application's frames-per-second can go.
(Default: -1 no frame rate limit imposed)public void setUseInput(boolean use)
use
- If true, the application will initialize and use input.
Set to false for headless applications that do not require keyboard
or mouse input.
(Default: true)public void setUseJoysticks(boolean use)
use
- If true, the application will initialize and use joystick
input. Set to false if no joystick input is desired.
(Default: false)public void setRenderer(java.lang.String renderer)
renderer
- The renderer to set
(Default: AppSettings.LWJGL_OPENGL2)public void setCustomRenderer(java.lang.Class<? extends JmeContext> clazz)
JmeContext
interface.
clazz
- The custom context class.
(Default: not set)public void setAudioRenderer(java.lang.String audioRenderer)
audioRenderer
- (Default: LWJGL)public void setWidth(int value)
value
- the width for the rendering display.
(Default: 640)public void setHeight(int value)
value
- the height for the rendering display.
(Default: 480)public void setResolution(int width, int height)
width
- The widthheight
- The height
(Default: 640x480)public void setFrequency(int value)
value
- The frequency
(Default: 60)public void setDepthBits(int value)
The number of depth bits specifies the precision of the depth buffer. To increase precision, specify 32 bits. To decrease precision, specify 16 bits. On some platforms 24 bits might not be supported, in that case, specify 16 bits.
(Default: 24)
value
- The depth bitspublic void setStencilBits(int value)
This value is only relevant when the stencil buffer is being used. Specify 8 to indicate an 8-bit stencil buffer, specify 0 to disable the stencil buffer.
(Default: 0)
value
- Number of stencil bitspublic void setBitsPerPixel(int value)
value
- The bits per pixel to set
(Default: 24)public void setSamples(int value)
value
- The number of samples
(Default: 1)public void setTitle(java.lang.String title)
title
- The title of the rendering display
(Default: jMonkeyEngine 3.0)public void setFullscreen(boolean value)
value
- true to enable full-screen rendering, false to render in a window
(Default: false)public void setVSync(boolean value)
value
- (Default: false)public void setStereo3D(boolean value)
This feature requires hardware support from the GPU driver.
public void setIcons(java.lang.Object[] value)
value
- An array of BufferedImages to use as icons.
(Default: not set)public void setSettingsDialogImage(java.lang.String path)
The image will be displayed in the settings dialog when the application is started.
(Default: /com/jme3/app/Monkey.png)
path
- The path to the image in the classpath.public int getFrameRate()
setFrameRate(int)
public boolean useInput()
setUseInput(boolean)
public java.lang.String getRenderer()
setRenderer(java.lang.String)
public int getWidth()
setWidth(int)
public int getHeight()
setHeight(int)
public int getBitsPerPixel()
setBitsPerPixel(int)
public int getFrequency()
setFrequency(int)
public int getDepthBits()
setDepthBits(int)
public int getStencilBits()
setStencilBits(int)
public int getSamples()
setSamples(int)
public java.lang.String getTitle()
setTitle(java.lang.String)
public boolean isVSync()
setVSync(boolean)
public boolean isFullscreen()
setFullscreen(boolean)
public boolean useJoysticks()
setUseJoysticks(boolean)
public java.lang.String getAudioRenderer()
setAudioRenderer(java.lang.String)
public boolean useStereo3D()
setStereo3D(boolean)
public java.lang.Object[] getIcons()
setIcons(java.lang.Object[])
public java.lang.String getSettingsDialogImage()
setSettingsDialogImage(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |