Class Maze3D

java.lang.Object
  |
  +--java.awt.Component
        |
        +--Maze3D

public class Maze3D
extends Component

Display a 3D maze using a 2D projection as an AWT component. Line drawings are used to represent walls and corners. The orientation of the view is variable: the player can stand on the walls or ceiling. The player can click on the left or right side to pivot left or right, near the top or bottom to pivot backward or forward or near the center to move forward. The following keystrokes are also accepted:

  • SPACE - move forward
  • L - pivot left
  • R - pivot right
  • B - roll back
  • F - roll forward
  • G - roll right
  • H - roll left
  • S - spin around
  • U - slide up
  • D - slide down
  • I - forward until a choice
  • W - forward until a wall
  • Z - follow until a choice
  • ? - show 2D maze
  • See Also:
    Serialized Form

    Fields inherited from class java.awt.Component
    BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
     
    Constructor Summary
    Maze3D(MazeModel model)
              Create a 3D maze display.
    Maze3D(MazeModel model, int width, int height)
              Create a 3D maze display.
     
    Method Summary
     Dimension getPreferredSize()
              From Component.getPreferredSize.
     boolean isFocusTraversable()
              From Component, this component can get keyboard input.
     void paint(Graphics g)
              From Component, paint the 2D projection of the maze based on the current position and view orientation.
     void setOrientation(byte front, byte right, byte up)
              Set the orientation of the view.
     
    Methods inherited from class java.awt.Component
    action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    Maze3D

    public Maze3D(MazeModel model)
    Create a 3D maze display. Defaults to a size of 300x300.
    Parameters:
    model - The MazeModel to use for the maze contents.

    Maze3D

    public Maze3D(MazeModel model,
                  int width,
                  int height)
    Create a 3D maze display.
    Parameters:
    model - The MazeModel to use for the maze contents.
    width - The display width of the Component.
    height - The display width of the Component.
    Method Detail

    isFocusTraversable

    public boolean isFocusTraversable()
    From Component, this component can get keyboard input.
    Overrides:
    isFocusTraversable in class Component

    getPreferredSize

    public Dimension getPreferredSize()
    From Component.getPreferredSize.
    Overrides:
    getPreferredSize in class Component

    setOrientation

    public void setOrientation(byte front,
                               byte right,
                               byte up)
    Set the orientation of the view. The parameters determine which direction is viewed and which "floor" or "wall" the player is standing on.
    Parameters:
    front - The dimension to the front of the player: XPL etc.
    right - The dimension to the right of the player.
    up - The dimension above the player.

    paint

    public void paint(Graphics g)
    From Component, paint the 2D projection of the maze based on the current position and view orientation.
    Overrides:
    paint in class Component