com.golden.gamedev.engine.graphics
Class WindowMode

java.lang.Object
  |
  +--com.golden.gamedev.engine.graphics.WindowMode
All Implemented Interfaces:
BaseGraphics, EventListener, WindowListener

public class WindowMode
extends Object
implements BaseGraphics, WindowListener

Graphics frame work for window environment, used by GameEngine to create game environment.


Field Summary
protected  Frame frmMain
           
static GraphicsConfiguration gc
           
 
Constructor Summary
WindowMode(Dimension d)
           
WindowMode(Dimension d, boolean useBufferStrategy)
           
 
Method Summary
 void cleanup()
          Releases all graphics resources and do finalization.
 boolean flip()
          Flips backbuffer to screen (primary surface).
 Graphics2D getBackBuffer()
          Returns backbuffer where the rendering perform.
 Component getComponent()
          Returns the component where the rendering perform.
 Dimension getSize()
          Returns the dimension of this graphics component.
 void windowActivated(WindowEvent e)
           
 void windowClosed(WindowEvent e)
           
 void windowClosing(WindowEvent e)
           
 void windowDeactivated(WindowEvent e)
           
 void windowDeiconified(WindowEvent e)
           
 void windowIconified(WindowEvent e)
           
 void windowOpened(WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gc

public static final GraphicsConfiguration gc

frmMain

protected Frame frmMain
Constructor Detail

WindowMode

public WindowMode(Dimension d,
                  boolean useBufferStrategy)

WindowMode

public WindowMode(Dimension d)
Method Detail

getSize

public Dimension getSize()
Description copied from interface: BaseGraphics
Returns the dimension of this graphics component.

Specified by:
getSize in interface BaseGraphics
Returns:
graphics dimension.

cleanup

public void cleanup()
Description copied from interface: BaseGraphics
Releases all graphics resources and do finalization.

Specified by:
cleanup in interface BaseGraphics

getBackBuffer

public Graphics2D getBackBuffer()
Description copied from interface: BaseGraphics
Returns backbuffer where the rendering perform.

Specified by:
getBackBuffer in interface BaseGraphics
Returns:
backbuffer graphics.

flip

public boolean flip()
Description copied from interface: BaseGraphics
Flips backbuffer to screen (primary surface). Since the backbuffer is VolatileImage type, the flipping data could be lost and need to be restored. Therefore, if this method return false, backbuffer needs to be rerendered.

For Example:

    do {
        Graphics2D g = BaseGraphics.getBackBuffer();
        //.... do graphics operation
    } while (BaseGraphics.flip() == false);
 
See VolatileImage for detail information.

Specified by:
flip in interface BaseGraphics
Returns:
true, if the flipping is successfully proceed
See Also:
BaseGraphics.getBackBuffer(), VolatileImage

getComponent

public Component getComponent()
Description copied from interface: BaseGraphics
Returns the component where the rendering perform.

Specified by:
getComponent in interface BaseGraphics
Returns:
graphics component.

windowActivated

public void windowActivated(WindowEvent e)
Specified by:
windowActivated in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent e)
Specified by:
windowDeactivated in interface WindowListener

windowClosed

public void windowClosed(WindowEvent e)
Specified by:
windowClosed in interface WindowListener

windowClosing

public void windowClosing(WindowEvent e)
Specified by:
windowClosing in interface WindowListener

windowDeiconified

public void windowDeiconified(WindowEvent e)
Specified by:
windowDeiconified in interface WindowListener

windowIconified

public void windowIconified(WindowEvent e)
Specified by:
windowIconified in interface WindowListener

windowOpened

public void windowOpened(WindowEvent e)
Specified by:
windowOpened in interface WindowListener