|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--waba.ui.Control
|
+--superwaba.ext.xplat.game.Animation
The Animation control class.
This control displays an animation that can be loaded from indexed BMP files (one frame per image) or by a multi-frames BMP. This kind of BMP file contains a list of images having all the same size and that lay side by side. You may use the MakeMultiBmp in /superwaba/utils/xplat/MakeMultiBmp folder to convert animated gif or a sequence of bmp files into the convenient format. warning: multi-frames BMP files can't be larger than 64Kb (the palmOS record limit)
superwaba.tools.makemultibmp.MakeMultiBmp| Field Summary | |
protected Image |
background
Background image. |
protected Graphics |
bgGfx
Background graphic context. |
protected int |
curFrame
Current frame of the animation. |
int |
drawOp
drawOp drawing operation used when the animation images are copied to the screen buffer. |
static int |
eventFinish
notify animation endings |
static int |
eventFrame
notify animation frames |
static int |
eventLoop
notify animation loops |
static int |
eventNone
no notify at all |
protected int |
eventsMask
Event notification mask, default value is eventFinish, that means that an event is posted only when the animation finishes. |
int |
framePeriod
Delay between two frames. |
protected Image[] |
framesBuffer
Frames buffer, all frames must have the same size. |
protected int |
insert
|
boolean |
isPaused
Reflects the animation pause state. |
boolean |
isPlaying
Reflects the animation play state. |
static int |
LOOPS_UNLIMITED
start function "loops" argument special value to loop endlessly |
protected int |
maxFrames
Maximum number of frames. |
protected Color |
transColor
Transparency color. |
| Fields inherited from class waba.ui.Control |
AFTER,
appId,
appObj,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
clearValueInt,
clearValueStr,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
focusTraversable,
font,
foreColor,
foreDis,
height,
highlightRectsCount,
isHighlighting,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
uiCE,
uiFlat,
uiPalm,
uiVista,
visible,
width,
x,
x2,
y,
y2 |
| Constructor Summary | |
protected |
Animation()
Animation constructor. |
|
Animation(Image frames,
int frameWidth,
Color transColor,
int framePeriod)
Animation constructor. |
| Method Summary | |
void |
drawFrame(int frame)
Display a given frame. |
void |
enableEvents(int mask)
Enable the posting of events. |
int |
getPreferredHeight()
Returns the prefered height of this control. |
int |
getPreferredWidth()
Returns the prefered width of this control. |
void |
onPaint(Graphics gfx)
Called by the system to draw the animation. |
void |
pause()
Pauses a running animation. if the application is not playing, this call has no effect. |
void |
renew(int maxFrames)
Clear the animation to add new frames. |
void |
resume()
Resumes a paused animation. if the application is not playing, this call has no effect. |
int |
size()
Number of frames in the animation. |
static Image[] |
splitImage(Image original,
int frameWidth)
This is a static helper function that divides a multi-frames BMP into distinguished Images. The original image size should be a multiple of the frame width. |
void |
start(int loops)
Starts the animation. |
void |
start(int[] frameSequence,
int loops)
Starts the animation with a non standard frame sequence. |
void |
start(int sFrame,
int eFrame,
int step,
int loops)
Starts the animation with a frame range. |
void |
stop()
Stops the animation. if the application is not playing, this call has no effect. |
| Methods inherited from class waba.ui.Control |
addTimer,
changeHighlighted,
clear,
contains,
createGraphics,
drawHighlight,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
isVisible,
onBoundsChanged,
onColorsChanged,
onEvent,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setEnabled,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible,
translateFromOrigin,
uiStyleChanged |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public int drawOp
Graphicspublic int framePeriod
protected int curFrame
public boolean isPlaying
public boolean isPaused
protected Color transColor
protected int maxFrames
protected Image[] framesBuffer
protected int insert
protected int eventsMask
public static final int eventNone
public static final int eventFinish
public static final int eventLoop
public static final int eventFrame
public static final int LOOPS_UNLIMITED
protected Image background
protected Graphics bgGfx
| Constructor Detail |
protected Animation()
public Animation(Image frames,
int frameWidth,
Color transColor,
int framePeriod)
frames - single image containing all frames in mlti-frames BMP format.frameWidth - width in pixels of one frame.transColor - the transparency colorframePeriod - delay in millisecconds between two framessuperwaba.tools.makemultibmp.MakeMultiBmp| Method Detail |
public void renew(int maxFrames)
throws GameEngineException
public int size()
public int getPreferredWidth()
public int getPreferredHeight()
public void drawFrame(int frame)
frame - index to display.public void onPaint(Graphics gfx)
g - the graphics object for drawingGraphicspublic void enableEvents(int mask)
public void pause()
public void resume()
public void stop()
public void start(int sFrame,
int eFrame,
int step,
int loops)
sFrame - start frameeFrame - end framestep - frame incrementloops - number of animation iterationspublic void start(int loops)
loops - integer value specifying the number of loops or LOOPS_UNLIMITED.LOOPS_UNLIMITED
public void start(int[] frameSequence,
int loops)
frameSequence - frame numbers array which defines the frames sequenceloops - integer value specifying the number of loops or LOOPS_UNLIMITED.LOOPS_UNLIMITED
public static Image[] splitImage(Image original,
int frameWidth)
original - multi-frames image.frameWidth - the width of a single frame.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||