Class Game
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----java.applet.Applet
|
+----Game
- public class Game
- extends Applet
This class produces the color matching game applet.
-
butSTART
-
-
buttonBar
- color space selector
-
buttons
- array of buttons
-
component0
- updatable component
-
component1
- updatable component
-
component2
- updatable component
-
hsvCoord
- peer of rgbLocal.
-
random
- randomizer
-
rgbLocal
- current color
-
rgbTarget
- target color (color being matched)
-
spaceID
- current color space code
-
updatableComponents
- vector of updatable components
-
xyz
- peer of rgbLocal.
-
yiqCoord
- peer of rgbLocal.
-
Game()
-
-
informOthers(int)
- Tells other components to update themselves.
-
init()
- Initializes the applet.
-
randomColor()
- Generates random color, avoiding really dark ones that are
hard to match by eye.
-
randomColor(RGBCoord)
- Generates random color, avoiding really dark ones that are
hard to match by eye.
-
recomputeCoordinates()
- Recomputes color coordinates.
-
registerComponent(UpdatableComponentImpl)
- Registers a component as updatable.
-
reset()
- Resets all the components.
spaceID
int spaceID
- current color space code
rgbTarget
RGBCoord rgbTarget
- target color (color being matched)
rgbLocal
RGBCoord rgbLocal
- current color
hsvCoord
HSVCoord hsvCoord
- peer of rgbLocal.
yiqCoord
YIQCoord yiqCoord
- peer of rgbLocal.
xyz
XYZSet xyz
- peer of rgbLocal.
updatableComponents
protected Vector updatableComponents
- vector of updatable components
random
Random random
- randomizer
component0
PlaneMatchAndStart component0
- updatable component
component1
ProgressText component1
- updatable component
component2
SlidersContainer component2
- updatable component
buttonBar
ButtonBar buttonBar
- color space selector
buttons
Button buttons[]
- array of buttons
butSTART
Button butSTART
Game
public Game()
init
public void init()
- Initializes the applet.
- Overrides:
- init in class Applet
registerComponent
protected void registerComponent(UpdatableComponentImpl comp)
- Registers a component as updatable.
- Parameters:
- comp - updatable component to be registered.
informOthers
void informOthers(int from_id)
- Tells other components to update themselves.
- Parameters:
- from_id - ID of the calling component.
reset
public void reset()
- Resets all the components.
recomputeCoordinates
protected void recomputeCoordinates()
- Recomputes color coordinates.
randomColor
protected int randomColor()
- Generates random color, avoiding really dark ones that are
hard to match by eye.
randomColor
protected int randomColor(RGBCoord rgbc)
- Generates random color, avoiding really dark ones that are
hard to match by eye.
- Parameters:
- rgbc - generated color goes here.