Also allow buffer swapping to be disabled, e.g. for Oculus Rift.experimental
parent
1fc730c78a
commit
809092c236
@ -0,0 +1,87 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2009-2015 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
package jme3test.app; |
||||||
|
|
||||||
|
import com.jme3.app.SimpleApplication; |
||||||
|
import com.jme3.font.BitmapText; |
||||||
|
import com.jme3.font.Rectangle; |
||||||
|
import com.jme3.material.Material; |
||||||
|
import com.jme3.scene.Geometry; |
||||||
|
import com.jme3.scene.shape.Box; |
||||||
|
import com.jme3.system.AppSettings; |
||||||
|
import jme3test.model.shape.TestBox; |
||||||
|
|
||||||
|
/** |
||||||
|
* Tests the capability to resize the application window. |
||||||
|
* |
||||||
|
* @author Kirill Vainer |
||||||
|
*/ |
||||||
|
public class TestResizableApp extends SimpleApplication { |
||||||
|
|
||||||
|
private BitmapText txt; |
||||||
|
|
||||||
|
public static void main(String[] args){ |
||||||
|
TestResizableApp app = new TestResizableApp(); |
||||||
|
AppSettings settings = new AppSettings(true); |
||||||
|
settings.setResizable(true); |
||||||
|
app.setSettings(settings); |
||||||
|
app.setShowSettings(false); |
||||||
|
app.start(); |
||||||
|
} |
||||||
|
|
||||||
|
public void reshape(int width, int height) { |
||||||
|
super.reshape(width, height); |
||||||
|
|
||||||
|
// Need to move text relative to app height
|
||||||
|
txt.setLocalTranslation(0, settings.getHeight(), 0); |
||||||
|
txt.setText("Drag the corners of the application to resize it.\n" + |
||||||
|
"Current Size: " + settings.getWidth() + "x" + settings.getHeight()); |
||||||
|
} |
||||||
|
|
||||||
|
public void simpleInitApp() { |
||||||
|
flyCam.setDragToRotate(true); |
||||||
|
|
||||||
|
Box b = new Box(1, 1, 1); |
||||||
|
Geometry geom = new Geometry("Box", b); |
||||||
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); |
||||||
|
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); |
||||||
|
geom.setMaterial(mat); |
||||||
|
rootNode.attachChild(geom); |
||||||
|
|
||||||
|
txt = new BitmapText(loadGuiFont(), false); |
||||||
|
txt.setText("Drag the corners of the application to resize it.\n" + |
||||||
|
"Current Size: " + settings.getWidth() + "x" + settings.getHeight()); |
||||||
|
txt.setLocalTranslation(0, settings.getHeight(), 0); |
||||||
|
guiNode.attachChild(txt); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue