public class MisoScenePanel extends VirtualMediaPanel implements MouseListener, MouseMotionListener, AStarPathUtil.TraversalPred, RadialMenu.Host
MediaPanel.ObscurerJComponent.AccessibleJComponentComponent.BaselineResizeBehavior| Modifier and Type | Field and Description |
|---|---|
static int |
SHOW_TIPS
Show flag that indicates we should show all tips.
|
CENTER_ON_PATHABLE, ENCLOSE_PATHABLE, TRACK_PATHABLETOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTALL, BACK, FRONTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
MisoScenePanel(MisoContext ctx,
MisoSceneMetrics metrics)
Creates a blank miso scene display.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotify() |
boolean |
canTraverse(Object traverser,
int tx,
int ty)
Requests to know if the specified traverser (which was provided in the call to
AStarPathUtil.getPath(TraversalPred,Object,int,int,int,int,int,boolean)) can traverse the
specified tile coordinate. |
void |
centerOnTile(int tx,
int ty)
Moves the scene such that the specified tile is in the center.
|
boolean |
checkShowFlag(int flag)
Check to see if the specified show flag is on.
|
void |
clearRadialMenu()
Clears any radial menu being displayed.
|
void |
computeIndicators()
Compute the indicators for any objects in the scene.
|
static void |
computeInfluentialBounds(Rectangle visibleBounds,
Rectangle influentualBounds,
Rectangle visibleBlockBounds)
Configures
influentialBounds to contain the bounds of the potentially
"influential" world and visibleBlockBounds to contain bounds that are used
to determine which blocks should be resolved before making the view visible. |
Iterator<SceneBlock> |
enumerateResolvedBlocks()
Returns an iterator over all resolved
SceneBlock instances. |
SceneBlock |
getBlock(int tx,
int ty)
Returns the resolved block that contains the specified tile coordinate or null if no block
is resolved for that coordinate.
|
Component |
getComponent()
If a frame participant wishes also to be actively rendered every
frame rather than use passive rendering (which for Swing, at least,
is hijacked when using the frame manager such that we take care of
repainting dirty Swing components every frame into our off-screen
buffer), it can return a component here which will have
Component.paint(java.awt.Graphics) called on it once per frame with a translated but
unclipped graphics object. |
Point |
getFullCoords(int x,
int y)
Converts the supplied screen coordinates to full coordinates.
|
Point |
getHoverCoords()
Returns the tile coordinates of the tile over which the mouse is hovering.
|
Object |
getHoverObject()
Returns the top-most object over which the mouse is hovering; this may be a sprite or a
SceneObject. |
Path |
getPath(Sprite sprite,
int x,
int y,
boolean loose)
Computes a path for the specified sprite to the specified tile coordinates.
|
MisoSceneMetrics |
getSceneMetrics()
Returns the scene metrics in use by this panel.
|
MisoSceneModel |
getSceneModel()
Returns the scene model being displayed by this panel.
|
Point |
getScreenCoords(int x,
int y)
Converts the supplied full coordinates to screen coordinates.
|
Point |
getTileCoords(int x,
int y)
Converts the supplied screen coordinates to tile coordinates.
|
Rectangle |
getViewBounds()
Returns the bounds of the viewport in virtual coordinates.
|
void |
menuDeactivated(RadialMenu menu) |
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
paint(Graphics g) |
void |
pressObject(SceneObject scobj)
Programmatically "click" a scene object.
|
void |
refreshScene()
Completely invalidates our current resolved scene and re-resolves it from the ground up.
|
void |
removeNotify() |
void |
repaintRect(int x,
int y,
int width,
int height) |
void |
reportMemoryUsage()
Reports the memory usage of the resolved tiles in the current scene block.
|
void |
setBounds(int x,
int y,
int width,
int height) |
void |
setSceneModel(MisoSceneModel model)
Configures this display with a scene model which will immediately be resolved and
displayed.
|
void |
setShowFlags(int flags,
boolean on)
Set whether or not to highlight object tooltips (and potentially other scene entities).
|
addViewTracker, clearPathable, doLayout, removeViewTracker, setBackground, setFollowsPathable, setViewLocationabortAnimation, addAnimation, addObscurer, addSprite, clearAnimations, clearSprites, createGraphics, getAnimationManager, getRegionManager, getSpriteManager, getTimeStamp, isManaged, isManaged, needsPaint, removeObscurer, removeSprite, repaint, setOpaque, setPaused, tickaddAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIadd, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int SHOW_TIPS
public MisoScenePanel(MisoContext ctx, MisoSceneMetrics metrics)
setSceneModel(com.threerings.miso.data.MisoSceneModel) to cause it to display something.public void setSceneModel(MisoSceneModel model)
public void refreshScene()
public void centerOnTile(int tx,
int ty)
public MisoSceneModel getSceneModel()
public MisoSceneMetrics getSceneMetrics()
public void setShowFlags(int flags,
boolean on)
public boolean checkShowFlag(int flag)
public Object getHoverObject()
SceneObject.public Point getHoverCoords()
public Iterator<SceneBlock> enumerateResolvedBlocks()
SceneBlock instances.public SceneBlock getBlock(int tx, int ty)
public Path getPath(Sprite sprite, int x, int y, boolean loose)
loose - if true, an approximate path will be returned if a complete path cannot be
located. This path will navigate the sprite "legally" as far as possible and then walk the
sprite in a straight line to its final destination. This is generally only useful if the
the path goes "off screen".public Point getScreenCoords(int x, int y)
public Point getFullCoords(int x, int y)
public Point getTileCoords(int x, int y)
public void clearRadialMenu()
public void reportMemoryUsage()
public void addNotify()
addNotify in class JComponentpublic void removeNotify()
removeNotify in class JComponentpublic void mouseClicked(MouseEvent e)
mouseClicked in interface MouseListenerpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenerpublic void pressObject(SceneObject scobj)
handleObjectPressed(com.threerings.miso.client.SceneObject, int, int) with click coordinates in the center of the object.public void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenerpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenerpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenerpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenerpublic void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenerpublic boolean canTraverse(Object traverser, int tx, int ty)
AStarPathUtil.TraversalPredAStarPathUtil.getPath(TraversalPred,Object,int,int,int,int,int,boolean)) can traverse the
specified tile coordinate.canTraverse in interface AStarPathUtil.TraversalPredpublic Rectangle getViewBounds()
VirtualMediaPanelgetViewBounds in interface RadialMenu.HostgetViewBounds in class VirtualMediaPanelpublic Component getComponent()
FrameParticipantComponent.paint(java.awt.Graphics) called on it once per frame with a translated but
unclipped graphics object.
Because clipping is expensive in terms of rectangle object allocation, frame participants are given the opportunity to do their own clipping because they are likely to want to clip to a more fine grained region than their entire bounds. If a participant does not wish to be actively rendered, it can safely return null.
getComponent in interface RadialMenu.HostgetComponent in interface FrameParticipantgetComponent in class MediaPanelpublic void repaintRect(int x,
int y,
int width,
int height)
repaintRect in interface RadialMenu.Hostpublic void menuDeactivated(RadialMenu menu)
menuDeactivated in interface RadialMenu.Hostpublic void setBounds(int x,
int y,
int width,
int height)
setBounds in class VirtualMediaPanelpublic static void computeInfluentialBounds(Rectangle visibleBounds, Rectangle influentualBounds, Rectangle visibleBlockBounds)
influentialBounds to contain the bounds of the potentially
"influential" world and visibleBlockBounds to contain bounds that are used
to determine which blocks should be resolved before making the view visible.
Everything that intersects the influential area will be resolved on the expectation that it could be scrolled into view at any time. The influential bounds should be large enough that the time between a block becoming influential and the time at which it is resolved is longer than the expected time by which it will be scrolled into view, otherwise the users will see the man behind the curtain.
public void computeIndicators()
public void paint(Graphics g)
paint in class MediaPanelCopyright © 2015. All rights reserved.