|
@@ -13,29 +13,43 @@ Every class that extends jme3.app.SimpleApplication has properties that can be c
|
|
|
|
|
|
</div>
|
|
|
<!-- EDIT1 SECTION "jME3 Application Display Settings" [1-465] -->
|
|
|
-<h2><a>Code Sample</a></h2>
|
|
|
+<h2><a>Code Samples</a></h2>
|
|
|
<div>
|
|
|
+
|
|
|
+<p>
|
|
|
+
|
|
|
+This is how you specify settinsg for MyGame (or Main or whatever you called your SimpleApplication instance) before the game starts:
|
|
|
+</p>
|
|
|
<pre>public static void main(String[] args) {
|
|
|
AppSettings settings = new AppSettings(true);
|
|
|
settings.setResolution(640,480);
|
|
|
- ... // other properties see below
|
|
|
-
|
|
|
- MyGame app = new MyGame(); // or Main or whatever you called your SimpleApplication
|
|
|
+ // ... other properties, see below
|
|
|
+ MyGame app = new MyGame();
|
|
|
app.setSettings(settings);
|
|
|
app.start();
|
|
|
}</pre>
|
|
|
|
|
|
<p>
|
|
|
-Set the boolean in the AppSettings contructor to true if you want to keep the default settings for everything that you do not specify. Set this parameter to false if you want to change some of the settings, but otherwise want the application to load user settings from previous launches.
|
|
|
+Set the boolean in the AppSettings contructor to true if you want to keep the default settings for values that you do not specify. Set this parameter to false if you want the application to load user settings from previous launches. In either case you can still customize individual settings.
|
|
|
</p>
|
|
|
|
|
|
<p>
|
|
|
-<p><div>Use <code>app.setShowSettings(true);</code> to present the user with a splashscreen and display settings dialog when starting the game, or <code>app.setShowSettings(false);</code> to hide the custom splashscreen. Set this boolean before calling <code>app.start()</code> on the SimpleApplication.
|
|
|
-</div></p>
|
|
|
+This example toggles the settings to fullscreen while the game is already running. Then it restarts the game context (not the whole game) which applies the changed settings.
|
|
|
</p>
|
|
|
+<pre>public void toggleToFullscreen() {
|
|
|
+ GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
|
|
+ DisplayMode[] modes = device.getDisplayModes();
|
|
|
+ int i=0; // note: there are usually several, let's pick the first
|
|
|
+ settings.setResolution(modes[i].getWidth(),modes[i].getHeight());
|
|
|
+ settings.setFrequency(modes[i].getRefreshRate());
|
|
|
+ settings.setDepthBits(modes[i].getBitDepth());
|
|
|
+ settings.setFullscreen(device.isFullScreenSupported());
|
|
|
+ app.setSettings(settings);
|
|
|
+ app.restart(); // restart the context to apply changes
|
|
|
+}</pre>
|
|
|
|
|
|
</div>
|
|
|
-<!-- EDIT2 SECTION "Code Sample" [466-1381] -->
|
|
|
+<!-- EDIT2 SECTION "Code Samples" [466-1941] -->
|
|
|
<h2><a>Properties</a></h2>
|
|
|
<div>
|
|
|
<div><table>
|
|
@@ -75,7 +89,7 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
|
|
|
60 fps</td>
|
|
|
</tr>
|
|
|
</table></div>
|
|
|
-<!-- EDIT4 TABLE [1406-3627] --><div><table>
|
|
|
+<!-- EDIT4 TABLE [1966-4187] --><div><table>
|
|
|
<tr>
|
|
|
<th>Settings Property (Input)</th><th>Description</th><th>Default</th>
|
|
|
</tr>
|
|
@@ -85,8 +99,14 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
|
|
|
<tr>
|
|
|
<td>setUseJoysticks(true)</td><td>Activate optional joystick support</td><td>false</td>
|
|
|
</tr>
|
|
|
+ <tr>
|
|
|
+ <td>setEmulateMouse(true)</td><td>Enable or disable mouse emulation for touchscreen-based devices. Setting this to true converts taps on the touchscreen to clicks, and finger swiping gestures over the touchscreen into mouse axis events.</td><td>false</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>setEmulateMouseFlipAxis(true,true)</td><td>Flips the X or Y (or both) axes for the emulated mouse. Set the first parameter to true to flip the x axis, and the second to flip the y axis.</td><td>false,false</td>
|
|
|
+ </tr>
|
|
|
</table></div>
|
|
|
-<!-- EDIT5 TABLE [3629-3918] --><div><table>
|
|
|
+<!-- EDIT5 TABLE [4189-4903] --><div><table>
|
|
|
<tr>
|
|
|
<th>Settings Property (Audio)</th><th>Description</th><th>Default</th>
|
|
|
</tr>
|
|
@@ -97,7 +117,7 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
|
|
|
<td>setStereo3D(true)</td><td>Enable 3D stereo. This feature requires hardware support from the GPU driver. See <object classid="java:org.netbeans.modules.javahelp.BrowserDisplayer"><param name="content" value="http://en.wikipedia.org/wiki/Quad_buffering"><param name="text" value="<html><u>Quad Buffering</u></html>"><param name="textColor" value="blue"></object>. Currently, your everday user's hardware does not support this, so you can ignore it for now.</td><td>false</td>
|
|
|
</tr>
|
|
|
</table></div>
|
|
|
-<!-- EDIT6 TABLE [3920-4344] --><div><table>
|
|
|
+<!-- EDIT6 TABLE [4905-5329] --><div><table>
|
|
|
<tr>
|
|
|
<th>Settings Property (Branding)</th><th>Description</th><th>Default</th>
|
|
|
</tr>
|
|
@@ -106,26 +126,54 @@ Set VSync to false to deactivate vertical syncing (faster, but possible page tea
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>setIcons(new BufferedImage[]{ <br/>
|
|
|
-ImageIO.read(new File("")), …});</td><td>This specifies the little application icon in the titlebar of the application. You should specify the icon in various sizes (256,128,32,16) to look good on each <acronym title="Operating System">OS</acronym>. Note: This is not the application icon on the desktop.</td><td>null</td>
|
|
|
+ImageIO.read(new File("")), …});</td><td>This specifies the little application icon in the titlebar of the application (unused in MacOS?). You should specify the icon in various sizes (256,128,32,16) to look good on various operating systems. Note: This is not the application icon on the desktop.</td><td>null</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>setSettingsDialogImage("Interface/mysplashscreen.png")</td><td>A custom splashscreen image in the <code>assets/Interface</code> directory which is displayed when the settings dialog is shown.</td><td>"/com/jme3/app/Monkey.png"</td>
|
|
|
+ </tr>
|
|
|
+</table></div>
|
|
|
+<!-- EDIT7 TABLE [5331-6038] -->
|
|
|
+<p>
|
|
|
+
|
|
|
+<p><div>You can use <code>app.setShowSettings(true);</code> and <code>setSettingsDialogImage("Interface/mysplashscreen.png")</code> to present the user with jme3's default display settings dialog when starting the game. Use <code>app.setShowSettings(false);</code> to hide the default settings screen. Set this boolean before calling <code>app.start()</code> on the SimpleApplication.
|
|
|
+</div></p>
|
|
|
+</p>
|
|
|
+
|
|
|
+</div>
|
|
|
+<!-- EDIT3 SECTION "Properties" [1942-6398] -->
|
|
|
+<h2><a>Toggling and Activating Settings</a></h2>
|
|
|
+<div>
|
|
|
+<div><table>
|
|
|
+ <tr>
|
|
|
+ <th>SimpleApplication method</th><th>Description</th>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>app.setShowSettings(boolean)</td><td>Activate or deactivate the default settings screen before start()ing the game. If you let users use this screen, you do not need to modify the settings object. Note: Most developers implement their own custom settings screen, but the default one is useful during the alpha stages.</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>app.setSettings(settings)</td><td>After you have modified the properties on the settings object, you apply it to your application. Note that the settings are not automatically reloaded while the game is running.</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>app.start()</td><td>Every game calls start() in the beginning to initialize the game and apply the settings. Modify and set your settings before calling start().</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
- <td>setSettingsDialogImage("/path/to/splash.png")</td><td>A custom splashscreen image in the assets directory which is displayed when the settings dialog is shown.</td><td>"/com/jme3/app/Monkey.png"</td>
|
|
|
+ <td>app.restart()</td><td>Restart()ing a running game restarts the game context and applies the updated settings object. (This does not restart or reinitialize the whole game.)</td>
|
|
|
</tr>
|
|
|
</table></div>
|
|
|
-<!-- EDIT7 TABLE [4346-4993] -->
|
|
|
+<!-- EDIT9 TABLE [6445-7326] -->
|
|
|
</div>
|
|
|
-<!-- EDIT3 SECTION "Properties" [1382-4994] -->
|
|
|
+<!-- EDIT8 SECTION "Toggling and Activating Settings" [6399-7327] -->
|
|
|
<h2><a>Saving and Loading Settings</a></h2>
|
|
|
<div>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
-An AppSettings object also supports the following methods:
|
|
|
+An AppSettings object also supports the following methods to save your settings under a unique key (in this example "com.foo.MyCoolGame3"):
|
|
|
</p>
|
|
|
<ul>
|
|
|
-<li><div> Use <code>settings.save("unique_key")</code> to save your settings via standard java.io serialization.</div>
|
|
|
+<li><div> Use <code>settings.save("com.foo.MyCoolGame3")</code> to save your settings via standard java.io serialization.</div>
|
|
|
</li>
|
|
|
-<li><div> Use <code>settings.load("unique_key")</code> to load your settings.</div>
|
|
|
+<li><div> Use <code>settings.load("com.foo.MyCoolGame3")</code> to load your settings.</div>
|
|
|
</li>
|
|
|
<li><div> Use <code>settings2.copyFrom(settings)</code> to copy a settings object.</div>
|
|
|
</li>
|
|
@@ -154,5 +202,5 @@ Provide the unique name of your jME3 application as the String argument. For exa
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
-<!-- EDIT8 SECTION "Saving and Loading Settings" [4995-] -->
|
|
|
+<!-- EDIT10 SECTION "Saving and Loading Settings" [7328-] -->
|
|
|
<p><em><a href="http://jmonkeyengine.org/wiki/doku.php/jme3:intermediate:appsettings?do=export_xhtmlbody">view online version</a></em></p>
|