net.groboclown.gui.tripleBuffer.v1.test
Class TerrainCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--net.groboclown.gui.tripleBuffer.v1.TripleBufferCanvas
                    |
                    +--net.groboclown.gui.tripleBuffer.v1.test.TerrainCanvas
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Runnable, Serializable

class TerrainCanvas
extends TripleBufferCanvas

See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.AWTTreeLock
 
Field Summary
(package private)  Color[] colorSet
           
(package private)  double dirX
           
(package private)  double dirY
           
(package private)  Heap drawHeap
           
(package private)  float lightSourceDX
           
(package private)  float lightSourceDY
           
(package private)  float lightSourceDZ
           
(package private)  TerrainMap map
           
(package private)  int maxBucketSize
           
(package private)  int maxDispX
           
(package private)  int maxDispY
           
(package private) static double NEAR_ZERO
           
(package private)  int[] passXpoints
           
(package private)  int[] passYpoints
           
(package private)  Unit[] units
           
(package private)  TerrainViewSpace view
           
(package private)  int[][] xpoints
           
(package private)  int[][] ypoints
           
 
Fields inherited from class net.groboclown.gui.tripleBuffer.v1.TripleBufferCanvas
bgcolor, currentIndex, drawer, drawEveryFrame, drawingIndex, gfx, height, img, isPaused, isRunning, repaintCount, waitTime, width
 
Fields inherited from class java.awt.Canvas
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TerrainCanvas(TerrainMap tm)
           
 
Method Summary
 void drawImage(Graphics g)
          No Z-ordering.
protected  Color getColor(int x, int y)
           
protected  void updateDisplay()
           
protected  void windowChangedSize()
          user supplied routine to capture resizing calls.
 
Methods inherited from class net.groboclown.gui.tripleBuffer.v1.TripleBufferCanvas
createImages, finalize, getWaitTime, isAlive, isFrameSkippingAllowed, paint, resume, run, setBounds, setFrameSkippingAllowed, setWaitTime, start, stop, update
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

NEAR_ZERO

static final double NEAR_ZERO

view

TerrainViewSpace view

map

TerrainMap map

units

Unit[] units

maxBucketSize

int maxBucketSize

drawHeap

Heap drawHeap

passXpoints

int[] passXpoints

passYpoints

int[] passYpoints

xpoints

int[][] xpoints

ypoints

int[][] ypoints

maxDispX

int maxDispX

maxDispY

int maxDispY

colorSet

Color[] colorSet

dirX

double dirX

dirY

double dirY

lightSourceDX

float lightSourceDX

lightSourceDY

float lightSourceDY

lightSourceDZ

float lightSourceDZ
Constructor Detail

TerrainCanvas

public TerrainCanvas(TerrainMap tm)
Method Detail

windowChangedSize

protected void windowChangedSize()
Description copied from class: TripleBufferCanvas
user supplied routine to capture resizing calls. Doesn't need to be re-implemented, but if your drawing method depends on heavily precalculated variables, based on window size, then implement this to recalculate everything. This is already synchronized.
Overrides:
windowChangedSize in class TripleBufferCanvas

updateDisplay

protected void updateDisplay()

drawImage

public void drawImage(Graphics g)
No Z-ordering. Need to change double array into single array with pointer math for greater array access efficiency. Color-putting right now dynamically creates every color. This can be very slow - try a table lookup instead!
Overrides:
drawImage in class TripleBufferCanvas
Following copied from class: net.groboclown.gui.tripleBuffer.v1.TripleBufferCanvas
Parameters:
buffer - the buffer to draw to; when we return this buffer will be sent to paint() for drawing.

getColor

protected Color getColor(int x,
                         int y)


Written under the LGPL