gzz.client
Class GraphicsAPI

java.lang.Object
  |
  +--gzz.client.GraphicsAPI
Direct Known Subclasses:
AWTAPI, GLAPI

public abstract class GraphicsAPI
extends java.lang.Object

An interface that both the OpenGL and java.awt.Graphics subsystems provide. This is currently a singleton class but that may change in the future.

The System property gzzclient sets the API type: either "awt" or "gl" should be used.


Nested Class Summary
static class GraphicsAPI.AbstractRenderingSurface
           
static class GraphicsAPI.AbstractWindow
           
static interface GraphicsAPI.RenderingSurface
          An interface for generic rendering surfaces.
static interface GraphicsAPI.Window
          An interface for windows visible on the screen.
 
Constructor Summary
GraphicsAPI()
           
 
Method Summary
abstract  GraphicsAPI.RenderingSurface createStableOffscreen(int w, int h)
          Create an off-screen rendering surface that does not get corrupted by other windows.
abstract  GraphicsAPI.Window createWindow()
          Create a new window.
static GraphicsAPI getInstance()
          Get the singleton instance.
abstract  TextStyle getTextStyle(java.lang.String family, int style, int size)
          Obtain a text style object for an abstract font at a given size.
static java.lang.String getTypeString()
          Return the type string of the API ("gl" or "awt").
abstract  void startUpdateManager(java.lang.Runnable r)
          Start the update manager thread and run r from that thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicsAPI

public GraphicsAPI()
Method Detail

getInstance

public static GraphicsAPI getInstance()
Get the singleton instance.


getTypeString

public static java.lang.String getTypeString()
Return the type string of the API ("gl" or "awt").


startUpdateManager

public abstract void startUpdateManager(java.lang.Runnable r)
Start the update manager thread and run r from that thread. Used because e.g. OpenGL and GLX are easier to manage if everything is done in one thread. Windows must not be created by any other thread.


createWindow

public abstract GraphicsAPI.Window createWindow()
Create a new window.


createStableOffscreen

public abstract GraphicsAPI.RenderingSurface createStableOffscreen(int w,
                                                                   int h)
Create an off-screen rendering surface that does not get corrupted by other windows.


getTextStyle

public abstract TextStyle getTextStyle(java.lang.String family,
                                       int style,
                                       int size)
Obtain a text style object for an abstract font at a given size. The parameters are as in java.awt.Font#Font()