Major media subsystem revamp:
- All images are loaded through the image manager - Architected to allow the use of prepared or unprepared images (and volatile images when the day comes that they support alpha) - Tunable caches for images and tiles - Resource manager caches unpacked resources on the filesystem - Various and sundry other cleanups git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2116 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
//
|
||||
// $Id: BobbleAnimation.java,v 1.5 2002/11/20 02:18:49 mdb Exp $
|
||||
// $Id: BobbleAnimation.java,v 1.6 2003/01/13 22:49:46 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.threerings.util.RandomUtil;
|
||||
|
||||
import com.threerings.media.Log;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* An animation that bobbles an image around within a specific horizontal
|
||||
@@ -29,10 +29,10 @@ public class BobbleAnimation extends Animation
|
||||
* @param duration the time to animate in milliseconds.
|
||||
*/
|
||||
public BobbleAnimation (
|
||||
Image image, int sx, int sy, int rx, int ry, int duration)
|
||||
Mirage image, int sx, int sy, int rx, int ry, int duration)
|
||||
{
|
||||
super(new Rectangle(sx - rx, sy - ry, sx + image.getWidth(null) + rx,
|
||||
sy + image.getHeight(null) + ry));
|
||||
super(new Rectangle(sx - rx, sy - ry, sx + image.getWidth() + rx,
|
||||
sy + image.getHeight() + ry));
|
||||
|
||||
// save things off
|
||||
_image = image;
|
||||
@@ -72,7 +72,7 @@ public class BobbleAnimation extends Animation
|
||||
// documentation inherited
|
||||
public void paint (Graphics2D gfx)
|
||||
{
|
||||
gfx.drawImage(_image, _x, _y, null);
|
||||
_image.paint(gfx, _x, _y);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -98,7 +98,7 @@ public class BobbleAnimation extends Animation
|
||||
protected int _sx, _sy;
|
||||
|
||||
/** The image to animate. */
|
||||
protected Image _image;
|
||||
protected Mirage _image;
|
||||
|
||||
/** Animation ending timing information. */
|
||||
protected long _duration, _end;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ExplodeAnimation.java,v 1.13 2002/10/01 04:24:34 shaper Exp $
|
||||
// $Id: ExplodeAnimation.java,v 1.14 2003/01/13 22:49:46 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -7,14 +7,14 @@ import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.threerings.util.RandomUtil;
|
||||
|
||||
import com.threerings.media.Log;
|
||||
import com.threerings.util.RandomUtil;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* An animation that displays an object exploding into chunks, fading out
|
||||
@@ -88,7 +88,7 @@ public class ExplodeAnimation extends Animation
|
||||
* @param height the height of the object.
|
||||
*/
|
||||
public ExplodeAnimation (
|
||||
Image image, ExplodeInfo info, int x, int y, int width, int height)
|
||||
Mirage image, ExplodeInfo info, int x, int y, int width, int height)
|
||||
{
|
||||
super(info.bounds);
|
||||
|
||||
@@ -233,7 +233,7 @@ public class ExplodeAnimation extends Animation
|
||||
if (_image != null) {
|
||||
// draw the image chunk
|
||||
gfx.clipRect(-_hcwid, -_hchei, _cwid, _chei);
|
||||
gfx.drawImage(_image, -_hcwid + xoff, -_hchei + yoff, null);
|
||||
_image.paint(gfx, -_hcwid + xoff, -_hchei + yoff);
|
||||
|
||||
} else {
|
||||
// draw the color chunk
|
||||
@@ -303,7 +303,7 @@ public class ExplodeAnimation extends Animation
|
||||
protected Color _color;
|
||||
|
||||
/** The image to animate if we're using an image. */
|
||||
protected Image _image;
|
||||
protected Mirage _image;
|
||||
|
||||
/** The starting animation time. */
|
||||
protected long _start;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: FadeAnimation.java,v 1.5 2002/10/01 04:24:34 shaper Exp $
|
||||
// $Id: FadeAnimation.java,v 1.6 2003/01/13 22:49:46 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
@@ -7,10 +7,10 @@ import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.threerings.media.Log;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* An animation that displays an image fading from one alpha level to
|
||||
@@ -30,9 +30,9 @@ public class FadeAnimation extends Animation
|
||||
* @param target the target alpha level.
|
||||
*/
|
||||
public FadeAnimation (
|
||||
Image image, int x, int y, float alpha, float step, float target)
|
||||
Mirage image, int x, int y, float alpha, float step, float target)
|
||||
{
|
||||
super(new Rectangle(x, y, image.getWidth(null), image.getHeight(null)));
|
||||
super(new Rectangle(x, y, image.getWidth(), image.getHeight()));
|
||||
|
||||
// save things off
|
||||
_image = image;
|
||||
@@ -90,7 +90,7 @@ public class FadeAnimation extends Animation
|
||||
} else {
|
||||
gfx.setComposite(_comp);
|
||||
}
|
||||
gfx.drawImage(_image, _x, _y, null);
|
||||
_image.paint(gfx, _x, _y);
|
||||
gfx.setComposite(ocomp);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public class FadeAnimation extends Animation
|
||||
protected int _x, _y;
|
||||
|
||||
/** The image to animate. */
|
||||
protected Image _image;
|
||||
protected Mirage _image;
|
||||
|
||||
/** The starting animation time. */
|
||||
protected long _start;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
//
|
||||
// $Id: SparkAnimation.java,v 1.1 2002/11/27 01:37:14 shaper Exp $
|
||||
// $Id: SparkAnimation.java,v 1.2 2003/01/13 22:49:46 mdb Exp $
|
||||
|
||||
package com.threerings.media.animation;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.threerings.media.animation.Animation;
|
||||
|
||||
import com.threerings.util.RandomUtil;
|
||||
|
||||
import com.threerings.media.animation.Animation;
|
||||
import com.threerings.media.image.Mirage;
|
||||
|
||||
/**
|
||||
* Displays a set of spark images originating from a specified position
|
||||
* and flying outward in random directions, fading out as they go, for a
|
||||
@@ -41,7 +41,7 @@ public class SparkAnimation extends Animation
|
||||
public SparkAnimation (Rectangle bounds, int x, int y, int jog,
|
||||
float minxvel, float minyvel,
|
||||
float xvel, float yvel,
|
||||
float g, Image[] images, long delay)
|
||||
float g, Mirage[] images, long delay)
|
||||
{
|
||||
super(bounds);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class SparkAnimation extends Animation
|
||||
gfx.setComposite(_comp);
|
||||
// draw all sparks
|
||||
for (int ii = 0; ii < _icount; ii++) {
|
||||
gfx.drawImage(_images[ii], _xpos[ii], _ypos[ii], null);
|
||||
_images[ii].paint(gfx, _xpos[ii], _ypos[ii]);
|
||||
}
|
||||
// restore the original composite
|
||||
gfx.setComposite(ocomp);
|
||||
@@ -158,7 +158,7 @@ public class SparkAnimation extends Animation
|
||||
}
|
||||
|
||||
/** The spark images we're animating. */
|
||||
protected Image[] _images;
|
||||
protected Mirage[] _images;
|
||||
|
||||
/** The number of images we're animating. */
|
||||
protected int _icount;
|
||||
|
||||
Reference in New Issue
Block a user