com.b3dgs.lionengine
Interface Drawable

All Known Implementing Classes:
DrawableFactory

public interface Drawable

Handle gfx ressources, such as images, sprites, tiles, animations... Fastest way to call drawable factory:

 import static com.b3dgs.lionengine.Drawable.DRAWABLE;
 //...
 DRAWABLE.xxx
 


Field Summary
static Drawable DRAWABLE
          Drawable factory.
 
Method Summary
 Animation createAnimation(int firstFrame, int lastFrame, int step, float speed, boolean reverse, boolean repeat)
          Create an animation, which can be read by an animated sprite.
 Animator createAnimator()
          Create an animation player, which we will be able to play an animation data container.
 Cursor createCursor(Screen screen, java.lang.String cursor)
          Create a cursor, which is automatically handled by the mouse.
 FontSprite createFontSprite(java.lang.String filename, java.lang.String data, int lw, int lh)
          Create a font based on an image.
 Text createText(java.lang.String fontname, int size, int style)
          Create a font, which supports screen output text.
 AnimatedSprite loadAnimatedSprite(java.awt.image.BufferedImage surface, int horizontalFrames, int verticalFrames)
          Create an animated sprite, giving horizontal and vertical frames (sharing the same surface).
 AnimatedSprite loadAnimatedSprite(java.lang.String filename, int horizontalFrames, int verticalFrames)
          Load an animated sprite from a file, giving horizontal and vertical frames.
 Image loadImage(java.awt.image.BufferedImage surface)
          Create an image from a buffered image (sharing the same surface).
 Image loadImage(java.lang.String filename)
          Load an image from a file.
 ParallaxedSprite loadParallaxedSprite(java.lang.String filename, int numberOfLines, int sx, int sy)
          Load a parallaxed sprite, for parallax effect.
 Sprite loadSprite(java.awt.image.BufferedImage surface)
          Create a sprite from a buffered image (sharing the same surface).
 Sprite loadSprite(java.lang.String filename)
          Load a sprite from a file.
 TiledSprite loadTiledSprite(java.awt.image.BufferedImage surface, int tileWidth, int tileHeight)
          Create a tiled sprite using an image reference, giving tile dimension (sharing the same surface).
 TiledSprite loadTiledSprite(java.lang.String filename, int tileWidth, int tileHeight)
          Load a tiled sprite from a file, giving tile dimension.
 

Field Detail

DRAWABLE

static final Drawable DRAWABLE
Drawable factory.

Method Detail

loadImage

Image loadImage(java.lang.String filename)
Load an image from a file.

Parameters:
filename - file name.
Returns:
loaded image.

loadImage

Image loadImage(java.awt.image.BufferedImage surface)
Create an image from a buffered image (sharing the same surface). It may be usefull in case of multiple images.

Parameters:
surface - file name.
Returns:
loaded image.

loadSprite

Sprite loadSprite(java.lang.String filename)
Load a sprite from a file.

Parameters:
filename - file name.
Returns:
loaded tiled sprite.

loadSprite

Sprite loadSprite(java.awt.image.BufferedImage surface)
Create a sprite from a buffered image (sharing the same surface). It may be usefull in case of multiple sprites.

Parameters:
surface - image reference.
Returns:
loaded sprite.

loadAnimatedSprite

AnimatedSprite loadAnimatedSprite(java.lang.String filename,
                                  int horizontalFrames,
                                  int verticalFrames)
Load an animated sprite from a file, giving horizontal and vertical frames.

Parameters:
filename - file name.
horizontalFrames - number of horizontal frames.
verticalFrames - number of vertical frames.
Returns:
loaded animated sprite.

loadAnimatedSprite

AnimatedSprite loadAnimatedSprite(java.awt.image.BufferedImage surface,
                                  int horizontalFrames,
                                  int verticalFrames)
Create an animated sprite, giving horizontal and vertical frames (sharing the same surface). It may be usefull in case of multiple animated sprites.

Parameters:
surface - image reference.
horizontalFrames - number of horizontal frames.
verticalFrames - number of vertical frames.
Returns:
loaded animated sprite.

loadTiledSprite

TiledSprite loadTiledSprite(java.lang.String filename,
                            int tileWidth,
                            int tileHeight)
Load a tiled sprite from a file, giving tile dimension.

Parameters:
filename - file name.
tileWidth - tile width.
tileHeight - tile height.
Returns:
loaded tiled sprite.

loadTiledSprite

TiledSprite loadTiledSprite(java.awt.image.BufferedImage surface,
                            int tileWidth,
                            int tileHeight)
Create a tiled sprite using an image reference, giving tile dimension (sharing the same surface). It may be usefull in case of multiple tiled sprites.

Parameters:
surface - image reference.
tileWidth - tile width.
tileHeight - tile height.
Returns:
loaded tiled sprite.

loadParallaxedSprite

ParallaxedSprite loadParallaxedSprite(java.lang.String filename,
                                      int numberOfLines,
                                      int sx,
                                      int sy)
Load a parallaxed sprite, for parallax effect.

Parameters:
filename - file name.
numberOfLines - number of parallax lines.
sx - starting width.
sy - starting height.
Returns:
loaded parallaxed sprite.

createAnimation

Animation createAnimation(int firstFrame,
                          int lastFrame,
                          int step,
                          float speed,
                          boolean reverse,
                          boolean repeat)
Create an animation, which can be read by an animated sprite. Minimum frame is 1. Note about the step: Mainly used for strategy games, where the entry has different orientations. The step represents the number of frames per orientation for this animation.

Parameters:
firstFrame - first frame index to play.
lastFrame - last frame index to play.
step - animation step number.
speed - animation playing speed.
reverse - true to reverse play (play from first to last, and last to first).
repeat - repeat state (loop play).
Returns:
created animation.

createAnimator

Animator createAnimator()
Create an animation player, which we will be able to play an animation data container.

Returns:
created animation player.

createText

Text createText(java.lang.String fontname,
                int size,
                int style)
Create a font, which supports screen output text.

Parameters:
fontname - font name.
size - font size (in px).
style - font style (NORMAL, BOLD, ITALIC).
Returns:
created text.
See Also:
Font.DIALOG, Font.MONOSPACED, Font.SANS_SERIF, Font.SERIF, Text.NORMAL, Text.BOLD, Text.ITALIC

createFontSprite

FontSprite createFontSprite(java.lang.String filename,
                            java.lang.String data,
                            int lw,
                            int lh)
Create a font based on an image.

Parameters:
filename - font surface filename.
data - font data filename.
lw - font image letter width.
lh - font image letter height.
Returns:
created font sprite.

createCursor

Cursor createCursor(Screen screen,
                    java.lang.String cursor)
Create a cursor, which is automatically handled by the mouse.

Parameters:
screen - screen reference.
cursor - cursor image name.
Returns:
created cursor.