|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.gameengine.icadroids.objects.graphics.Sprite
public class Sprite
Sprite holds and handles correct loading of images (bitmaps), and includes some useful methods for getting information about the image.
Field Summary | |
---|---|
static java.util.Vector<Sprite> |
loadDelayedSprites
|
protected Bitmap |
spriteBitmap
The bitmap that the sprite uses |
protected int |
spriteHeight
The height in pixels of the sprite |
protected int |
spriteWidth
The width in pixels of the sprite |
Constructor Summary | |
---|---|
Sprite()
Make a Sprite without loading any bitmap in it |
|
Sprite(java.lang.String resourceName)
Load a sprite with the given resource Sprites must be stored in the res/drawable folders of your Android project. |
Method Summary | |
---|---|
protected void |
calculateSize(Bitmap sprite)
Calculate the size of the sprite. |
int |
getFrameHeight()
Get the height of the sprite |
int |
getFrameWidth()
Get the width of the sprite |
Bitmap |
getSprite()
Get the sprite in Bitmap. |
float |
getSpriteCenterX()
Get the center width of the sprite |
float |
getSpriteCenterY()
Get the center height of the sprite |
void |
initialize()
Initialize the sprite image. |
void |
loadSprite(java.lang.String resourceName)
Load the given resource in the sprite object Sprites must be stored in the res/drawable folders of your Android project. |
void |
setSprite(Bitmap sprite)
Load a bitmap into a sprite Note: bitmaps are already loaded images, when you want to load a resource that hasn't been loaded yet, use 'loadSprite()' |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Bitmap spriteBitmap
protected int spriteWidth
protected int spriteHeight
public static java.util.Vector<Sprite> loadDelayedSprites
Constructor Detail |
---|
public Sprite()
public Sprite(java.lang.String resourceName)
resourceName
- The name of the resource in the /res/drawable folder
without extension , so when your picture in the
/res/drawable is named 'picture.jpg', this parameter should be
'picture' .Method Detail |
---|
public void loadSprite(java.lang.String resourceName)
resourceName
- The name of the resource in the /res/drawable folder
without extension , so when your picture in the
/res/drawable is named 'picture.jpg', this parameter should be
'picture' .public void initialize()
protected final void calculateSize(Bitmap sprite)
sprite
- The bitmap that needs to be calculatedpublic final Bitmap getSprite()
public int getFrameWidth()
public final int getFrameHeight()
public final void setSprite(Bitmap sprite)
sprite
- The bitmap that need to be loadedpublic float getSpriteCenterX()
public float getSpriteCenterY()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |