diff options
author | Sven Gothel <[email protected]> | 2008-11-27 03:27:17 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-11-27 03:27:17 +0000 |
commit | 62daa94704f3f5125916b81a3494d45ab0c0d09a (patch) | |
tree | 4292296ffb209dd616788eeb5bdc5c5ebe0e557e /src/classes/com/sun/javafx/newt/Screen.java | |
parent | 47c0b60fa9fdd1df48cad1ec999ba40c3185e28f (diff) |
Newt-KD: working inc. events. Screen size can be set w/ property newt.ws.swidth newt.ws.sheight
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1807 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/javafx/newt/Screen.java')
-rwxr-xr-x | src/classes/com/sun/javafx/newt/Screen.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/classes/com/sun/javafx/newt/Screen.java b/src/classes/com/sun/javafx/newt/Screen.java index 7a4209826..4cd8ee5c3 100755 --- a/src/classes/com/sun/javafx/newt/Screen.java +++ b/src/classes/com/sun/javafx/newt/Screen.java @@ -57,6 +57,11 @@ public abstract class Screen { protected static Screen create(String type, Display display, int idx) { try { + if(usrWidth<0 || usrHeight<0) { + usrWidth = NewtFactory.getPropertyIntValue("newt.ws.swidth"); + usrHeight = NewtFactory.getPropertyIntValue("newt.ws.sheight"); + System.out.println("User screen size "+usrWidth+"x"+usrHeight); + } Class screenClass = getScreenClass(type); Screen screen = (Screen) screenClass.newInstance(); screen.display = display; @@ -96,8 +101,37 @@ public abstract class Screen { return handle; } + /** + * The actual implementation shall return the detected display value, + * if not we return 800. + * This can be overwritten with the user property 'newt.ws.swidth', + */ + public int getWidth() { + return (usrWidth>0) ? usrWidth : (width>0) ? width : 480; + } + + /** + * The actual implementation shall return the detected display value, + * if not we return 480. + * This can be overwritten with the user property 'newt.ws.sheight', + */ + public int getHeight() { + return (usrHeight>0) ? usrHeight : (height>0) ? height : 480; + } + + /** + * The actual implementation shall call this function + * to set the detected screen size + */ + public void setScreenSize(int w, int h) { + System.out.println("Detected screen size "+w+"x"+h); + width=w; height=h; + } + protected Display display; protected int index; protected long handle; + protected int width=-1, height=-1; // detected values: set using setScreenSize + protected static int usrWidth=-1, usrHeight=-1; // property values: newt.ws.swidth and newt.ws.sheight } |