Remove the rest of the implementation reflection

This commit is contained in:
Elias Naur 2007-01-17 12:58:38 +00:00
parent 7742185e34
commit 083137884b
4 changed files with 17 additions and 52 deletions

View File

@ -108,7 +108,6 @@ public final class Sys {
}
private static SysImplementation createImplementation() {
String class_name;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_LINUX:
return new LinuxSysImplementation();

View File

@ -86,30 +86,20 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
static {
Sys.initialize();
String class_name;
implementation = createImplementation();
}
private static AWTCanvasImplementation createImplementation() {
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_LINUX:
class_name = "org.lwjgl.opengl.LinuxCanvasImplementation";
break;
return new LinuxCanvasImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.WindowsCanvasImplementation";
break;
return new WindowsCanvasImplementation();
case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXCanvasImplementation";
break;
return new MacOSXCanvasImplementation();
default:
throw new IllegalStateException("Unsupported platform");
}
try {
Class impl_class = Class.forName(class_name);
implementation = (AWTCanvasImplementation)impl_class.newInstance();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
/**

View File

@ -73,30 +73,20 @@ final class Context {
static {
Sys.initialize();
String class_name;
implementation = createImplementation();
}
private static ContextImplementation createImplementation() {
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_LINUX:
class_name = "org.lwjgl.opengl.LinuxContextImplementation";
break;
return new LinuxContextImplementation();
case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.WindowsContextImplementation";
break;
return new WindowsContextImplementation();
case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXContextImplementation";
break;
return new MacOSXContextImplementation();
default:
throw new IllegalStateException("Unsupported platform");
}
try {
Class impl_class = Class.forName(class_name);
implementation = (ContextImplementation)impl_class.newInstance();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
PeerInfo getPeerInfo() {

View File

@ -133,30 +133,16 @@ public final class Display {
}
private static DisplayImplementation createDisplayImplementation() {
String class_name;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_LINUX:
class_name = "org.lwjgl.opengl.LinuxDisplay";
break;
return new LinuxDisplay();
case LWJGLUtil.PLATFORM_WINDOWS:
class_name = "org.lwjgl.opengl.WindowsDisplay";
break;
return new WindowsDisplay();
case LWJGLUtil.PLATFORM_MACOSX:
class_name = "org.lwjgl.opengl.MacOSXDisplay";
break;
return new MacOSXDisplay();
default:
throw new IllegalStateException("Unsupported platform");
}
try {
Class display_class = Class.forName(class_name);
return (DisplayImplementation)display_class.newInstance();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
/**