|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.MetaMediaManager
public class MetaMediaManager
Coordinates interaction between a sprite and animation manager and the media host that hosts and
renders them. This class is a little fiddly because MediaPanel has been around a long
time and is thoroughly out in the wild and now that we need to abstract out a bunch of its
functionality, we're constrained by all the extant usages and derivations.
| Field Summary | |
|---|---|
protected AnimationManager |
_animmgr
The animation manager in use by this panel. |
protected int[] |
_dirty
Used to keep metrics. |
protected float |
_dirtyPerTick
Used to keep metrics. |
protected FrameManager |
_framemgr
The frame manager with whom we register. |
protected MediaHost |
_host
Our media host, so gracious and accomodating. |
protected boolean |
_paused
Whether we're currently paused. |
protected long |
_pauseTime
Used to track the clock time at which we were paused. |
protected Label |
_perfLabel
|
protected Rectangle |
_perfRect
|
protected String |
_perfStatus
|
protected RegionManager |
_remgr
Used to accumulate and merge dirty regions on each tick. |
protected SpriteManager |
_spritemgr
The sprite manager in use by this panel. |
protected int |
_tick
Used to keep metrics. |
| Fields inherited from interface com.threerings.media.MediaConstants |
|---|
ALL, BACK, FRONT |
| Constructor Summary | |
|---|---|
MetaMediaManager(FrameManager framemgr,
MediaHost host)
|
|
| Method Summary | |
|---|---|
void |
abortAnimation(Animation anim)
Aborts a currently running animation and removes it from this panel. |
void |
addAnimation(Animation anim)
Adds an animation to this panel. |
void |
addSprite(Sprite sprite)
Adds a sprite to this panel. |
void |
clearAnimations()
Removes all animations from this panel. |
void |
clearSprites()
Removes all sprites from this panel. |
AnimationManager |
getAnimationManager()
Returns a reference to the animation manager used by this media panel. |
FrameManager |
getFrameManager()
Returns the frame manager with which we are coordinating. |
RegionManager |
getRegionManager()
Returns the region manager used to coordinate our dirty regions. |
SpriteManager |
getSpriteManager()
Returns a reference to the sprite manager used by this media panel. |
long |
getTimeStamp()
Returns a timestamp from the MediaTimer used to track time intervals for this media
panel. |
boolean |
isManaged(Animation anim)
|
boolean |
isManaged(Sprite sprite)
|
boolean |
isPaused()
Returns true if we are paused, false if we are running normally. |
Iterator<AbstractMedia> |
iterator()
|
boolean |
needsPaint()
Our media front end should implement FrameParticipant and call this method in their
FrameParticipant.needsPaint() method. |
void |
noteDirty(int regions)
Called by the host to coordinate dirty region tracking. |
void |
paintMedia(Graphics2D gfx,
int layer,
Rectangle dirty)
Renders the sprites and animations that intersect the supplied dirty region in the specified layer. |
void |
paintPerf(Graphics2D gfx)
Renders our performance debugging information if enabled. |
void |
removeSprite(Sprite sprite)
Removes a sprite from this panel. |
void |
setPaused(boolean paused)
Pauses the sprites and animations that are currently active on this media panel. |
void |
tick(long tickStamp)
Our media front end should implement FrameParticipant and call this method in their
FrameParticipant.tick(long) method. |
void |
viewLocationDidChange(int dx,
int dy)
If our host supports scrolling around in a virtual view, it should call this method when the view origin changes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected FrameManager _framemgr
protected MediaHost _host
protected RegionManager _remgr
protected AnimationManager _animmgr
protected SpriteManager _spritemgr
protected boolean _paused
protected long _pauseTime
protected int[] _dirty
protected int _tick
protected float _dirtyPerTick
protected String _perfStatus
protected Label _perfLabel
protected Rectangle _perfRect
| Constructor Detail |
|---|
public MetaMediaManager(FrameManager framemgr,
MediaHost host)
| Method Detail |
|---|
public FrameManager getFrameManager()
public AnimationManager getAnimationManager()
public SpriteManager getSpriteManager()
public RegionManager getRegionManager()
public boolean isPaused()
public void setPaused(boolean paused)
public long getTimeStamp()
MediaTimer used to track time intervals for this media
panel. Note: this should only be called from the AWT thread.
public void addSprite(Sprite sprite)
public boolean isManaged(Sprite sprite)
public void removeSprite(Sprite sprite)
public void clearSprites()
public void addAnimation(Animation anim)
public boolean isManaged(Animation anim)
public void abortAnimation(Animation anim)
public void clearAnimations()
public void noteDirty(int regions)
public void tick(long tickStamp)
FrameParticipant and call this method in their
FrameParticipant.tick(long) method. They must also first check isPaused() and not
call this method if we are paused. As they will probably want to have willTick() and
didTick() calldown methods, we cannot handle pausedness for them.
public boolean needsPaint()
FrameParticipant and call this method in their
FrameParticipant.needsPaint() method.
public void paintMedia(Graphics2D gfx,
int layer,
Rectangle dirty)
public void paintPerf(Graphics2D gfx)
public void viewLocationDidChange(int dx,
int dy)
public Iterator<AbstractMedia> iterator()
iterator in interface Iterable<AbstractMedia>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||