diff options
author | Sven Gothel <[email protected]> | 2008-06-21 02:33:51 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-06-21 02:33:51 +0000 |
commit | 006acbb9463af33a8b45aa0b3a298604eba72d82 (patch) | |
tree | 2c71662575a2c098b22c4b19b471bb5c732041c5 /src/classes/com/sun/javafx/newt/Screen.java | |
parent | cbc45e816f4ee81031bffce19a99550681462a24 (diff) |
2nd big refactoring.
Goals are orthogonal components for:
- OS Windowing system
- NEWT, X11, Windows, MacOsX
- GL Windowing GLUE
- EGL, GLX, WGL, CGL
- GL profiles
- core and util packages
- generate all Java components from any platform
All above goals are achieved.
TODO:
- Native compilation fix and test
- Check/Fix Win32, MacOSX and the mobile devices
- ..
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1665 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 | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/classes/com/sun/javafx/newt/Screen.java b/src/classes/com/sun/javafx/newt/Screen.java index 77414d00e..38669b9e0 100755 --- a/src/classes/com/sun/javafx/newt/Screen.java +++ b/src/classes/com/sun/javafx/newt/Screen.java @@ -35,32 +35,52 @@ package com.sun.javafx.newt; public abstract class Screen { + private static Class getScreenClass(String type) + throws ClassNotFoundException + { + Class screenClass = null; + if (NewtFactory.KD.equals(type)) { + screenClass = Class.forName("com.sun.javafx.newt.kd.KDScreen"); + } else if (NewtFactory.WINDOWS.equals(type)) { + screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen"); + } else if (NewtFactory.X11.equals(type)) { + screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen"); + } else if (NewtFactory.MACOSX.equals(type)) { + screenClass = Class.forName("com.sun.javafx.newt.macosx.MacOSXScreen"); + } else { + throw new RuntimeException("Unknown window type \"" + type + "\""); + } + return screenClass; + } + protected static Screen create(String type, Display display, int idx) { try { - Class screenClass = null; - if (NewtFactory.KD.equals(type)) { - screenClass = Class.forName("com.sun.javafx.newt.kd.KDScreen"); - } else if (NewtFactory.WINDOWS.equals(type)) { - screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen"); - } else if (NewtFactory.X11.equals(type)) { - screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen"); - } else if (NewtFactory.MACOSX.equals(type)) { - screenClass = Class.forName("com.sun.javafx.newt.macosx.MacOSXScreen"); - } else { - throw new RuntimeException("Unknown window type \"" + type + "\""); - } + Class screenClass = getScreenClass(type); Screen screen = (Screen) screenClass.newInstance(); screen.display = display; screen.index = idx; screen.handle = 0; - screen.initNative(); + screen.createNative(); + return screen; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + protected static Screen wrapHandle(String type, Display display, int idx, long handle) { + try { + Class screenClass = getScreenClass(type); + Screen screen = (Screen) screenClass.newInstance(); + screen.display = display; + screen.index = idx; + screen.handle = handle; return screen; } catch (Exception e) { throw new RuntimeException(e); } } - protected abstract void initNative(); + protected abstract void createNative(); public Display getDisplay() { return display; |