|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unifreiburg.twodeedoo.world.demo.DemoWorld
public class DemoWorld
Demonstration world for the world package.
The user controls a red ball in a blue sky above a green ground. Gravity pulls the ball downward. As long as the user presses UP, An upward wind blows the ball upward. Pressing ESC quits the game.
The world demands a 640x480 simulation window and a simulation with a timeslice of 20ms.
Constructor Summary | |
---|---|
DemoWorld()
|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DemoWorld()
Method Detail |
---|
public int getWidth()
IWorld
getWidth
in interface IWorld
public int getHeight()
IWorld
getHeight
in interface IWorld
public int getCycleTimeMs()
IWorld
IWorld.onTick(ISimulationController)
.
The simulator should not call IWorld.onTick(ISimulationController)
more
frequently than that.
To be called during setup.
getCycleTimeMs
in interface IWorld
public java.lang.String getTitle()
IWorld
getTitle
in interface IWorld
public void onTick(ISimulationController controller)
IWorld
onTick
in interface IWorld
controller
- to stop the simulationpublic void onKeyPressed(int keyCode, ISimulationController controller)
IWorld
onKeyPressed
in interface IWorld
keyCode
- key code from KeyEvent
, e.g. KeyEvent.VK_LEFT
.controller
- to stop the simulationpublic void onKeyReleased(int keyCode, ISimulationController controller)
IWorld
onKeyReleased
in interface IWorld
keyCode
- key code from KeyEvent
, e.g. KeyEvent.VK_LEFT
.controller
- to stop the simulationpublic void paint(ICanvas canvas)
IWorld
paint
in interface IWorld
canvas
- a canvas with simple drawing methods.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |