Skip to content

Instantly share code, notes, and snippets.

@soh335
Created December 3, 2010 05:30
Show Gist options
  • Save soh335/726616 to your computer and use it in GitHub Desktop.
Save soh335/726616 to your computer and use it in GitHub Desktop.
commit 5759d56b385bb0c79dfcd4d03926d1df671e2a7b
Author: soh335 <[email protected]>
Date: Fri Dec 3 14:28:29 2010
setX and setY for LwjglDisplay
diff --git a/src/core/com/jme3/system/AppSettings.java b/src/core/com/jme3/system/AppSettings.java
index 5d715dd..82b1371 100644
--- a/src/core/com/jme3/system/AppSettings.java
+++ b/src/core/com/jme3/system/AppSettings.java
@@ -56,6 +56,8 @@ public class AppSettings extends HashMap<String, Object> {
static {
defaults.put("Width", 640);
defaults.put("Height", 480);
+ defaults.put("X", 0);
+ defaults.put("Y", 0);
defaults.put("BitsPerPixel", 24);
defaults.put("Frequency", 60);
defaults.put("DepthBits", 24);
@@ -192,6 +194,14 @@ public class AppSettings extends HashMap<String, Object> {
public void setHeight(int value){
putInteger("Height", value);
}
+
+ public void setX(int value) {
+ putInteger("X", value);
+ }
+
+ public void setY(int value) {
+ putInteger("Y", value);
+ }
public void setResolution(int width, int height){
setWidth(width);
@@ -241,6 +251,14 @@ public class AppSettings extends HashMap<String, Object> {
public int getHeight(){
return getInteger("Height");
}
+
+ public int getX(){
+ return getInteger("X");
+ }
+
+ public int getY(){
+ return getInteger("Y");
+ }
public int getBitsPerPixel(){
return getInteger("BitsPerPixel");
diff --git a/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java b/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java
index d310d71..46cbc11 100644
--- a/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java
+++ b/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java
@@ -86,6 +86,10 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
Display.setTitle(settings.getTitle());
if (displayMode != null)
Display.setDisplayMode(displayMode);
+
+ if (!settings.isFullscreen()) {
+ Display.setLocation(settings.getX(), settings.getY());
+ }
Display.setFullscreen(settings.isFullscreen());
Display.setVSyncEnabled(settings.isVSync());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment