|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.ui.Control | +--waba.ui.Container | +--waba.ui.Window | +--waba.ui.MainWindow | +--superwaba.ext.xplat.game.GameEngineMainWindow | +--superwaba.ext.xplat.game.GameEngine
This abstract class represents the game API engine.
Version 1.1 of the GameEngine features:
Field Summary | |
static int |
GAME_ENGINE_VERSION
|
String |
gameCreatorID
Game CreatorID. |
boolean |
gameDoClearScreen
True if the screen should be cleared before the onPaint() call. |
protected boolean |
gameHasUI
Must be set to true if the game screen has any control from the waba.ui package. |
int |
gameHighscoresSize
Amount of highscores entries in the highscores database. |
boolean |
gameIsDoubleBuffered
True if the game uses SuperWaba's double buffering feature. |
protected boolean |
gameIsRunning
True if the game is running. |
String |
gameName
Name of the game. |
int |
gameRefreshPeriod
Automatic refresh period in milliseconds. |
int |
gameVersion
Game version. |
static int |
NO_AUTO_REFRESH
No automatic refresh. |
Fields inherited from class waba.ui.MainWindow |
defaultFont |
Fields inherited from class waba.ui.Window |
beepIfOut,
borderStyle,
canDrag,
eraseBackgroundNow,
flicker,
HIDE_STATE,
highResPrepared,
imgCovered,
lastSwappedContainer,
mainSwapContainer,
menubar,
needsPaint,
NO_BORDER,
RECT_BORDER,
ROUND_BORDER,
TAB_BORDER,
TAB_ONLY_BORDER,
title,
titleFont,
topMost,
VK_BOTTOM,
VK_HIDE,
VK_TOP,
zStack |
Fields inherited from class waba.ui.Container |
BORDER_LOWERED,
BORDER_NONE,
BORDER_RAISED,
BORDER_SIMPLE,
children,
lastH,
lastW,
lastX,
lastY,
parentWindow,
tail |
Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
Constructor Summary | |
GameEngine()
Creates a new GameEngine |
Method Summary | |
TextRenderer |
createTextRenderer(Font font,
Color foreColor,
String text,
int maxDigits)
Create a new TextRenderer. |
HighScores |
getHighScores()
Get the game highscores. |
Options |
getOptions()
Get a new instance of the game options. |
void |
onGameExit()
Event notication called when the game exits. |
abstract void |
onGameInit()
Event notication called when the game is initialized. |
void |
onGameStart()
Event notication called when the game mainloop is entered. |
void |
onGameStop()
Event notication called when the game mainloop is leaved. |
void |
onKey(KeyEvent evt)
Event notication called when a key event is signaled. |
void |
onOtherEvent(Event evt)
Event notication called when any other event is signaled. |
void |
onPaint(Graphics g)
Called at each refresh to draw the current game state |
void |
onPenDown(PenEvent evt)
Event notication called when an pen down event is signaled. |
void |
onPenDrag(PenEvent evt)
Event notication called when an pen drag/move event is signaled. |
void |
onPenUp(PenEvent evt)
Event notication called when an pen up event is signaled. |
void |
onTimer(ControlEvent evt)
Event notication called when a control event is signaled. |
void |
refresh()
This function causes an onPaint() call to draw a new frame. This function has to be called in non time based games to refresh the complete screen. |
void |
start()
Must be called to start the game. |
void |
stop()
Must be called to make the game stop. |
Methods inherited from class superwaba.ext.xplat.game.GameEngineMainWindow |
onEvent,
onExit,
onStart,
setGameEngine |
Methods inherited from class waba.ui.MainWindow |
_onTimerTick,
_runThreads,
addThread,
addTimer,
appEnding,
appStarting,
exit,
getCommandLine,
getFontMetrics,
getMainWindow,
killThreads,
removeThread,
removeTimer |
Methods inherited from class waba.ui.Window |
_doPaint,
_doPaint,
_postEvent,
damageRect,
destroyZStack,
dontSaveBehind,
getClientRect,
getFocus,
getOffScreen,
getPreferredHeight,
getPreferredWidth,
getTopMost,
isTopMost,
isVisible,
loadBehind,
makeUnmovable,
onClickedOutside,
onPopup,
onUnpop,
paintTitle,
popupBlockingModal,
popupMenuBar,
popupModal,
postPopup,
postUnpop,
pumpEvents,
saveBehind,
setBorderStyle,
setDoubleBuffer,
setFocus,
setMenuBar,
setStatePosition,
setTitle,
setTitleFont,
swap,
unpop,
validate |
Methods inherited from class waba.ui.Container |
add,
add,
add,
broadcastEvent,
findChild,
getChildren,
onColorsChanged,
paintChildren,
remove,
setEnabled |
Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
onBoundsChanged,
onFontChanged,
onWindowPaintFinished,
postEvent,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public static final int GAME_ENGINE_VERSION
public String gameName
public String gameCreatorID
public int gameVersion
public int gameHighscoresSize
public static final int NO_AUTO_REFRESH
gameRefreshPeriod
public int gameRefreshPeriod
refresh
public boolean gameIsDoubleBuffered
public boolean gameDoClearScreen
protected boolean gameIsRunning
protected boolean gameHasUI
Constructor Detail |
public GameEngine()
Method Detail |
public abstract void onGameInit()
public void onGameExit()
public void onGameStart()
#run
public void onGameStop()
stop()
public void onTimer(ControlEvent evt)
evt
- control event that occurred.public void onKey(KeyEvent evt)
evt
- key event that occurred.public void onPenDown(PenEvent evt)
evt
- pen event that occurred.public void onPenUp(PenEvent evt)
evt
- pen event that occurred.public void onPenDrag(PenEvent evt)
evt
- pen event that occurred.public void onOtherEvent(Event evt)
evt
- event that occurred.public void onPaint(Graphics g)
g
- the graphics object for drawingGraphics
public HighScores getHighScores()
public Options getOptions()
public final TextRenderer createTextRenderer(Font font, Color foreColor, String text, int maxDigits)
font
- to display with.foreColor
- text color, may be null.text
- to render.maxDigits
- digits to display (with leading zeros).TextRenderer for more information
public final void start()
public final void stop()
public final void refresh()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |