GTGE API

com.golden.gamedev.engine.graphics
Class WindowedMode

java.lang.Object
  extended by com.golden.gamedev.engine.graphics.WindowedMode
All Implemented Interfaces:
BaseGraphics

public class WindowedMode
extends Object
implements BaseGraphics

Graphics engine for Windowed Environment.

See BaseGraphics for how to use graphics engine separated from Golden T Game Engine (GTGE) Frame Work.


Field Summary
static GraphicsConfiguration CONFIG
          The graphics configuration that constructs this graphics engine.
static GraphicsDevice DEVICE
          The graphics device that constructs this graphics engine.
 
Constructor Summary
WindowedMode(Dimension d, boolean bufferstrategy)
          Creates new instance of Windowed Graphics Engine with specified size, and whether want to use bufferstrategy or volatile image.
 
Method Summary
 void cleanup()
          Releases any system graphics resources and do finalization.
 boolean flip()
          Flips backbuffer to the screen (primary surface).
 Graphics2D getBackBuffer()
          Returns backbuffer where the rendering perform.
 Component getComponent()
          Returns the component where the rendering perform.
 Frame getFrame()
          Returns the top level frame where this graphics engine is being put on.
 String getGraphicsDescription()
          Returns graphics engine description, for example: fullscreen, windowed, applet, fullscreen with bufferstrategy, etc.
 Dimension getSize()
          Returns graphics engine dimension.
 Image getWindowIcon()
          Returns graphics engine window icon image or null if setting window icon image is not supported.
 String getWindowTitle()
          Returns graphics engine window title or String "" if setting window title is not supported.
 boolean isBufferStrategy()
          Returns whether this graphics engine is using buffer strategy or volatile image.
 void setWindowIcon(Image icon)
          Sets graphics engine window icon image.
 void setWindowTitle(String st)
          Sets graphics engine window title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEVICE

public static final GraphicsDevice DEVICE
The graphics device that constructs this graphics engine.


CONFIG

public static final GraphicsConfiguration CONFIG
The graphics configuration that constructs this graphics engine.

Constructor Detail

WindowedMode

public WindowedMode(Dimension d,
                    boolean bufferstrategy)
Creates new instance of Windowed Graphics Engine with specified size, and whether want to use bufferstrategy or volatile image.

Method Detail

getBackBuffer

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

Specified by:
getBackBuffer in interface BaseGraphics

flip

public boolean flip()
Description copied from interface: BaseGraphics
Flips backbuffer to the screen (primary surface). Since most graphics engine backbuffer is VolatileImage type, thus the flipping data could be lost and need to be restored. Therefore, if this method return false, backbuffer need 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()

cleanup

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

Specified by:
cleanup in interface BaseGraphics

getSize

public Dimension getSize()
Description copied from interface: BaseGraphics
Returns graphics engine dimension.

Specified by:
getSize in interface BaseGraphics

getComponent

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

Specified by:
getComponent in interface BaseGraphics

getFrame

public Frame getFrame()
Returns the top level frame where this graphics engine is being put on.


isBufferStrategy

public boolean isBufferStrategy()
Returns whether this graphics engine is using buffer strategy or volatile image.


getGraphicsDescription

public String getGraphicsDescription()
Description copied from interface: BaseGraphics
Returns graphics engine description, for example: fullscreen, windowed, applet, fullscreen with bufferstrategy, etc.

Specified by:
getGraphicsDescription in interface BaseGraphics

setWindowTitle

public void setWindowTitle(String st)
Description copied from interface: BaseGraphics
Sets graphics engine window title.

Note: Not all graphics engine support for setting window title, for example applet graphics engine.

Specified by:
setWindowTitle in interface BaseGraphics

getWindowTitle

public String getWindowTitle()
Description copied from interface: BaseGraphics
Returns graphics engine window title or String "" if setting window title is not supported.

Specified by:
getWindowTitle in interface BaseGraphics

setWindowIcon

public void setWindowIcon(Image icon)
Description copied from interface: BaseGraphics
Sets graphics engine window icon image.

Note: Not all graphics engine support for setting window icon, for example applet graphics engine.

Specified by:
setWindowIcon in interface BaseGraphics
See Also:
ImageUtil.getImage(java.net.URL)

getWindowIcon

public Image getWindowIcon()
Description copied from interface: BaseGraphics
Returns graphics engine window icon image or null if setting window icon image is not supported.

Specified by:
getWindowIcon in interface BaseGraphics

GTGE API

Copyright © 2003-2005 Golden T Studios. All rights reserved. Use is subject to license terms.
GoldenStudios.or.id