public class PwSnake extends PjWorkshop implements java.awt.event.KeyListener, java.lang.Runnable
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
Constructor and Description |
---|
PwSnake()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Remove key listener from display, reset elementSet
to state before starting the game, and destroy dialog window.
|
void |
init()
Resets all properties to default values.
|
void |
keyPressed(java.awt.event.KeyEvent e)
Store, if "Right" or "Left" key is pressed.
|
void |
keyReleased(java.awt.event.KeyEvent e)
Store, if "Right" or "Left" key is pressed.
|
void |
keyTyped(java.awt.event.KeyEvent e)
Just to fullfill KeyListener interface.
|
void |
pause()
Pauses the game.
|
void |
reset()
Reset workshop and geometry to original state.
|
void |
resume()
Resumes a paused game.
|
void |
run()
Run the snake until it dies.
|
void |
setDisplay(PvDisplayIf display)
Store currently active display.
|
void |
setGeometry(PgGeometry geom)
Assign a geometry on which this workshop operates,
|
void |
start()
Start snake game in separate thread.
|
void |
stop()
Stop snake game in separate thread.
|
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
cancel, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, openDialog, removeGeometry, setDisplays, setModal, setMode, setStandalone, setViewer
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFather, getName, setParent
public void init()
init
in class PjWorkshop
public void setGeometry(PgGeometry geom)
setGeometry
in interface PjWorkshopIf
setGeometry
in class PjWorkshop
geom
- the workshop modifies this geometry.public void reset()
reset
in class PjWorkshop
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PjWorkshop
event
- sender of this update.PsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public void setDisplay(PvDisplayIf display)
setDisplay
in interface PjWorkshopIf
setDisplay
in class PjWorkshop
public void close()
close
in class PjWorkshop
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void start()
public void stop()
public void pause()
public void resume()
public void run()
run
in interface java.lang.Runnable
"