42 |
/** The singleton instance. |
/** The singleton instance. |
43 |
*/ |
*/ |
44 |
private static GraphicsAPI gfxapi; |
private static GraphicsAPI gfxapi; |
45 |
|
private static String type; |
46 |
|
|
47 |
static { |
static { |
48 |
String cl = System.getProperty("gzzclient"); |
String cl = System.getProperty("gzzclient"); |
49 |
if(cl == null || cl.equals("awt")) |
if(cl == null || cl.equals("awt")) { |
50 |
gfxapi = new gzz.client.awt.AWTAPI(); |
gfxapi = new gzz.client.awt.AWTAPI(); |
51 |
else if(cl.equals("gl")) |
type = "awt"; |
52 |
|
} else if(cl.equals("gl")) { |
53 |
gfxapi = new gzz.client.gl.GLAPI(); |
gfxapi = new gzz.client.gl.GLAPI(); |
54 |
else |
type = "gl"; |
55 |
|
} else |
56 |
throw new Error("Invalid client type '"+cl+"': should be awt or gl"); |
throw new Error("Invalid client type '"+cl+"': should be awt or gl"); |
57 |
} |
} |
58 |
|
|
59 |
/** Get the singleton instance. |
/** Get the singleton instance. |
60 |
*/ |
*/ |
61 |
static public GraphicsAPI getInstance() { return gfxapi; } |
static public GraphicsAPI getInstance() { return gfxapi; } |
62 |
|
|
63 |
|
/** Return the type string of the API ("gl" or "awt"). |
64 |
|
*/ |
65 |
|
static public String getTypeString() { return type; } |
66 |
|
|
67 |
/** Start the update manager thread and run r from that thread. |
/** Start the update manager thread and run r from that thread. |
68 |
* Used because e.g. OpenGL and GLX are easier to manage if everything |
* Used because e.g. OpenGL and GLX are easier to manage if everything |