Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1051 | chris | 1 | package com.gebauz.bauzoid.graphics.spritex; |
| 2 | |||
| 3 | import com.gebauz.bauzoid.graphics.Graphics; |
||
| 4 | import com.gebauz.bauzoid.graphics.GraphicsObject; |
||
| 5 | import com.gebauz.bauzoid.math.collisionx.Shape; |
||
| 6 | |||
| 7 | /** TODO: one day, generalize so that "Sprite" becomes an AtlasSprite with just one frame. */ |
||
| 8 | public class AtlasSpriteInstance extends GraphicsObject |
||
| 9 | { |
||
| 10 | |||
| 11 | |||
| 12 | // Constants======================================================================================== |
||
| 13 | |||
| 14 | // Embedded Types=================================================================================== |
||
| 15 | |||
| 16 | // Fields=========================================================================================== |
||
| 17 | |||
| 18 | public SpriteParameters param = new SpriteParameters(); |
||
| 19 | |||
| 20 | private AtlasSprite mSource = null; |
||
| 21 | private AtlasSpriteFrame mFrames[] = null; |
||
| 22 | |||
| 23 | private Shape mShape = null; |
||
| 24 | |||
| 25 | // Methods========================================================================================== |
||
| 26 | public AtlasSpriteInstance(Graphics graphics, AtlasSprite sprite, AtlasSpriteFrame[] frames, Shape shape) |
||
| 27 | { |
||
| 28 | super(graphics); |
||
| 29 | |||
| 30 | mSource = sprite; |
||
| 31 | mShape = shape; |
||
| 32 | mFrames = frames; |
||
| 33 | } |
||
| 34 | |||
| 35 | public void renderFrame(int n) |
||
| 36 | { |
||
| 37 | mFrames[n].param.apply(param); |
||
| 38 | mFrames[n].render(); |
||
| 39 | } |
||
| 40 | |||
| 41 | // Getters/Setters================================================================================== |
||
| 42 | |||
| 43 | public final AtlasSprite getSprite() { return mSource; } |
||
| 44 | public final AtlasSpriteFrame getFrame(int n) { return mFrames[n]; } |
||
| 45 | public final Shape getShape() { return mShape; } |
||
| 46 | |||
| 47 | } |
||
| 48 | |||
| 49 |