| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--MainDisplay
This class is the panel on which the action part of the game is rendered. At
each tick, this panel is repainted with the contents of the screen that is in
the location for the local player as returned by GameSetup.getLocalPlayer.
This uses the scrolling, scaling, and optimize options specified by GameSetup.
The only method that should really be used from the outside is getClickLocation.
You could also call setForceDraw, but that can also be achieved by turning the
draw optimization off for one tick in the GameSetup.
Field Summary | |
protected Screen | lastScreen |
protected int | sizex |
protected int | sizey |
Fields inherited from class javax.swing.JComponent |
ui, listenerList, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, accessibleContext |
Fields inherited from class java.awt.Component |
TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT |
Constructor Summary | |
MainDisplay(MainFrame mf) This mainly figures out what size this panel should "prefer" to be. |
Method Summary | |
void | draw(Player player) Draw the display assuming the player passed in. |
Location | getClickLocation(int x, int y) This function does a conversion from display coordinates to the locations coordinates in the screen that it is displaying. |
int | getDrawX(Location loc) This function tells you the physical display x for a given location on the screen. |
int | getDrawY(Location loc) This function tells you the physical display y for a given location on the screen. |
Dimension | getPreferredSize() Returns the size that this display would be without any scaling for the drawing options it was first set up to use. |
void | paintComponent(Graphics g) Renders the image drawn by the draw method to the provided Graphics object. |
void | setForceDraw() Tell the display that at the next draw call (typically the next tick) that it must redraw all of the blocks for the background and can't use a buffered image. |
Methods inherited from class javax.swing.JPanel |
updateUI, getUIClassID, paramString, getAccessibleContext |
Methods inherited from class javax.swing.JComponent |
setUI, getComponentGraphics, paintChildren, paintBorder, update, paint, printAll, print, printComponent, printChildren, printBorder, isPaintingTile, isFocusCycleRoot, isManagingFocus, setNextFocusableComponent, getNextFocusableComponent, setRequestFocusEnabled, isRequestFocusEnabled, requestFocus, grabFocus, setVerifyInputWhenFocusTarget, getVerifyInputWhenFocusTarget, setPreferredSize, setMaximumSize, getMaximumSize, setMinimumSize, getMinimumSize, isMinimumSizeSet, isPreferredSizeSet, isMaximumSizeSet, contains, setBorder, getBorder, getInsets, getInsets, getAlignmentY, setAlignmentY, getAlignmentX, setAlignmentX, setInputVerifier, getInputVerifier, getGraphics, setDebugGraphicsOptions, getDebugGraphicsOptions, registerKeyboardAction, registerKeyboardAction, unregisterKeyboardAction, getRegisteredKeyStrokes, getConditionForKeyStroke, getActionForKeyStroke, resetKeyboardActions, setInputMap, getInputMap, getInputMap, setActionMap, getActionMap, requestDefaultFocus, setVisible, hide, setEnabled, setForeground, setBackground, setFont, isFocusTraversable, processFocusEvent, processComponentKeyEvent, processKeyEvent, processKeyBinding, setToolTipText, getToolTipText, getToolTipText, getToolTipLocation, createToolTip, scrollRectToVisible, setAutoscrolls, getAutoscrolls, processMouseMotionEvent, enable, disable, getClientProperty, putClientProperty, isLightweightComponent, reshape, getBounds, getSize, getLocation, getX, getY, getWidth, getHeight, hasFocus, isOpaque, setOpaque, computeVisibleRect, getVisibleRect, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener, fireVetoableChange, addVetoableChangeListener, removeVetoableChangeListener, getTopLevelAncestor, addAncestorListener, removeAncestorListener, getListeners, addNotify, removeNotify, repaint, repaint, revalidate, isValidateRoot, isOptimizedDrawingEnabled, paintImmediately, paintImmediately, setDoubleBuffered, isDoubleBuffered, getRootPane |
Methods inherited from class java.awt.Container |
getComponentCount, countComponents, getComponent, getComponents, insets, add, add, add, add, add, addImpl, remove, remove, removeAll, getLayout, setLayout, doLayout, layout, invalidate, validate, validateTree, preferredSize, minimumSize, paintComponents, printComponents, addContainerListener, removeContainerListener, processEvent, processContainerEvent, deliverEvent, getComponentAt, locate, getComponentAt, findComponentAt, findComponentAt, isAncestorOf, list, list |
Methods inherited from class java.awt.Component |
getName, setName, getParent, getPeer, setDropTarget, getDropTarget, getGraphicsConfiguration, getTreeLock, getToolkit, isValid, isDisplayable, isVisible, isShowing, isEnabled, enable, enableInputMethods, show, show, getForeground, getBackground, getFont, getLocale, setLocale, getColorModel, getLocation, getLocationOnScreen, location, setLocation, move, setLocation, getSize, size, setSize, resize, setSize, resize, getBounds, bounds, setBounds, setBounds, isLightweight, getFontMetrics, setCursor, getCursor, paintAll, repaint, repaint, repaint, imageUpdate, createImage, createImage, prepareImage, prepareImage, checkImage, checkImage, inside, contains, dispatchEvent, postEvent, addComponentListener, removeComponentListener, addFocusListener, removeFocusListener, addHierarchyListener, removeHierarchyListener, addHierarchyBoundsListener, removeHierarchyBoundsListener, addKeyListener, removeKeyListener, addMouseListener, removeMouseListener, addMouseMotionListener, removeMouseMotionListener, addInputMethodListener, removeInputMethodListener, getInputMethodRequests, getInputContext, enableEvents, disableEvents, coalesceEvents, processComponentEvent, processMouseEvent, processInputMethodEvent, processHierarchyEvent, processHierarchyBoundsEvent, handleEvent, mouseDown, mouseDrag, mouseUp, mouseMove, mouseEnter, mouseExit, keyDown, keyUp, action, gotFocus, lostFocus, transferFocus, nextFocus, add, remove, toString, list, list, list, setComponentOrientation, getComponentOrientation |
Methods inherited from class java.lang.Object |
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize |
Field Detail |
protected Screen lastScreen
protected int sizex
protected int sizey
Constructor Detail |
public MainDisplay(MainFrame mf)
Method Detail |
public void draw(Player player)
public Location getClickLocation(int x, int y)
public int getDrawX(Location loc)
public int getDrawY(Location loc)
public Dimension getPreferredSize()
public void paintComponent(Graphics g)
public void setForceDraw()
Association Links |
to Class java.awt.image.BufferedImage
to Class Screen
to Class java.awt.Dimension
to Class MainFrame
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |