net.lenkaspace.creeper.view
Class CRRenderer

java.lang.Object
  extended by java.awt.Component
      extended by net.lenkaspace.creeper.view.CRRenderer
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener

public class CRRenderer
extends java.awt.Component
implements java.awt.event.ActionListener

Uses Java's native rendering techniques to display CRBaseSituatedModel objects in the world.

Version:
2.0
Author:
Lenka Pitonakova contact@lenkaspace.net
See Also:
Serialized Form

Nested Class Summary
static class CRRenderer.DIRECTION
           
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String CR_BLACK_DOT
           
static java.lang.String CR_BLANK_CIRCLE
           
static java.lang.String CR_BLUE_CIRCLE
           
static java.lang.String CR_BLUE_DOT
           
static java.lang.String CR_GRAY_CIRCLE
           
static java.lang.String CR_GRAY_DOT
           
static java.lang.String CR_GREEN_CIRCLE
           
static java.lang.String CR_GREEN_DOT
           
static java.lang.String CR_PURPLE_CIRCLE
           
static java.lang.String CR_PURPLE_DOT
           
static java.lang.String CR_RED_CIRCLE
           
static java.lang.String CR_RED_DOT
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
CRRenderer(CRController controller_)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Called each time interval.
 void centerAtViewPosition(CRVector3d viewPosition_)
           
 void drawImageAt(java.awt.image.BufferedImage img_, CRVector3d pos_, CRVector3d size_, double rot_, double alpha_, java.awt.Graphics g)
          Draw an image
 void drawTextAt(CRVector3d pos_, java.lang.String string_, java.awt.Color color_, java.awt.Graphics g)
          Draw text of a specified color
 CRImageProvider getImageProvider()
           
 double getViewPositionX()
           
 double getViewPositionY()
           
 void moveView(CRRenderer.DIRECTION direction_, int amount_)
           
 void paint(java.awt.Graphics g)
          Main rendering function
 void setImageProvider(CRImageProvider imageProvider_)
           
 void setShouldOverrideNoPaint(boolean value_)
           
 void setViewPosition(CRVector3d viewPosition_)
           
 void setWorld(CRWorld world_)
           
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CR_BLACK_DOT

public static java.lang.String CR_BLACK_DOT

CR_BLUE_DOT

public static java.lang.String CR_BLUE_DOT

CR_GRAY_DOT

public static java.lang.String CR_GRAY_DOT

CR_GREEN_DOT

public static java.lang.String CR_GREEN_DOT

CR_PURPLE_DOT

public static java.lang.String CR_PURPLE_DOT

CR_RED_DOT

public static java.lang.String CR_RED_DOT

CR_BLANK_CIRCLE

public static java.lang.String CR_BLANK_CIRCLE

CR_BLUE_CIRCLE

public static java.lang.String CR_BLUE_CIRCLE

CR_GRAY_CIRCLE

public static java.lang.String CR_GRAY_CIRCLE

CR_GREEN_CIRCLE

public static java.lang.String CR_GREEN_CIRCLE

CR_PURPLE_CIRCLE

public static java.lang.String CR_PURPLE_CIRCLE

CR_RED_CIRCLE

public static java.lang.String CR_RED_CIRCLE
Constructor Detail

CRRenderer

public CRRenderer(CRController controller_)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Called each time interval. Calls repaint.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

paint

public void paint(java.awt.Graphics g)
Main rendering function

Overrides:
paint in class java.awt.Component

moveView

public void moveView(CRRenderer.DIRECTION direction_,
                     int amount_)

drawImageAt

public void drawImageAt(java.awt.image.BufferedImage img_,
                        CRVector3d pos_,
                        CRVector3d size_,
                        double rot_,
                        double alpha_,
                        java.awt.Graphics g)
Draw an image

Parameters:
img_ - BufferedImage to draw
pos_ - CRVector3d position [x,y,z]
rot_ - double rotation in radians
g - Graphics object

drawTextAt

public void drawTextAt(CRVector3d pos_,
                       java.lang.String string_,
                       java.awt.Color color_,
                       java.awt.Graphics g)
Draw text of a specified color

Parameters:
pos_ - CRVector3d position [x,y,z]
string_ - String text to display
color_ - Color color of text
g - Graphics object

setShouldOverrideNoPaint

public void setShouldOverrideNoPaint(boolean value_)

setWorld

public void setWorld(CRWorld world_)

getImageProvider

public CRImageProvider getImageProvider()

setImageProvider

public void setImageProvider(CRImageProvider imageProvider_)

getViewPositionX

public double getViewPositionX()

getViewPositionY

public double getViewPositionY()

setViewPosition

public void setViewPosition(CRVector3d viewPosition_)

centerAtViewPosition

public void centerAtViewPosition(CRVector3d viewPosition_)