|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface BaseGraphics
BaseGraphics interface provides all needed graphics function
for drawing unto screen.
Common methods of how-to-use BaseGraphics:
public class GraphicsEngine implements BaseGraphics {
.....
public static void main(String[] args) {
BaseGraphics engine = new GraphicsEngine(...);
// game loop
while (true) {
do {
// get backbuffer
Graphics2D g = engine.getBackBuffer();
// draw to backbuffer
g.drawImage(...);
// flip to screen
} while (engine.flip() == false);
}
// dispose graphics engine
engine.cleanup();
}
}
| 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. |
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. |
void |
setWindowIcon(Image icon)
Sets graphics engine window icon image. |
void |
setWindowTitle(String st)
Sets graphics engine window title. |
| Method Detail |
|---|
Graphics2D getBackBuffer()
boolean flip()
For example:
do {
Graphics2D g = BaseGraphics.getBackBuffer();
//.... do graphics operation
} while (BaseGraphics.flip() == false);
See VolatileImage for detail information.
getBackBuffer()void cleanup()
Dimension getSize()
Component getComponent()
String getGraphicsDescription()
void setWindowTitle(String st)
Note: Not all graphics engine support for setting window title, for example applet graphics engine.
String getWindowTitle()
String "" if
setting window title is not supported.
void setWindowIcon(Image icon)
Note: Not all graphics engine support for setting window icon, for example applet graphics engine.
ImageUtil.getImage(java.net.URL)Image getWindowIcon()
null if
setting window icon image is not supported.
|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||