|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IWorld
A world contains state which updates over time and on keypress, and it displays its state on a canvas.
Simpler than full twodeedoo.
Method Summary | |
---|---|
int |
getCycleTimeMs()
Desired cycle time of the simulation, i.e. |
int |
getHeight()
Desired height in pixels of the inside of the simulation window (call during setup). |
java.lang.String |
getTitle()
Title of the game. |
int |
getWidth()
Desired width in pixels of the inside of the simulation window (call during setup). |
void |
onKeyPressed(int keyCode,
ISimulationController controller)
A key has been pressed. |
void |
onKeyReleased(int keyCode,
ISimulationController controller)
A key has been released |
void |
onTick(ISimulationController controller)
Time has passed. |
void |
paint(ICanvas canvas)
Paint the current state of the world onto the canvas. |
Method Detail |
---|
java.lang.String getTitle()
int getWidth()
int getHeight()
int getCycleTimeMs()
onTick(ISimulationController)
.
The simulator should not call onTick(ISimulationController)
more
frequently than that.
To be called during setup.
void onTick(ISimulationController controller)
controller
- to stop the simulationvoid onKeyPressed(int keyCode, ISimulationController controller)
keyCode
- key code from KeyEvent
, e.g. KeyEvent.VK_LEFT
.controller
- to stop the simulationvoid onKeyReleased(int keyCode, ISimulationController controller)
keyCode
- key code from KeyEvent
, e.g. KeyEvent.VK_LEFT
.controller
- to stop the simulationvoid paint(ICanvas canvas)
canvas
- a canvas with simple drawing methods.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |