CupWidget

Cup widget

Constructors

this
this(StatusWidget status)
Undocumented in source.

Members

Functions

addScore
void addScore(int score)
Undocumented in source. Be warned that the author may not have intended to support it.
animate
void animate(long interval)

animates window; interval is time left from previous draw, in hnsecs (1/10000000 of second)

cellRect
Rect cellRect(Rect rc, int col, int row)
Undocumented in source. Be warned that the author may not have intended to support it.
destroyFullRows
void destroyFullRows()
Undocumented in source. Be warned that the author may not have intended to support it.
drawCell
void drawCell(DrawBuf buf, Rect cellRc, uint color, int offset)

draw cup cell

drawFigure
void drawFigure(DrawBuf buf, Rect rc, FigurePosition figure, int dy, uint alpha)

draw figure

handleAction
bool handleAction(Action a)

override to handle specific actions

handleFastDown
bool handleFastDown(bool fast)

Turn on / off fast falling down

initialize
void initialize(int cols, int rows)

init cup

measure
void measure(int parentWidth, int parentHeight)

Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

newGame
void newGame()

start new game

nextFigure
void nextFigure()

try start next figure

onAnimationFinished
void onAnimationFinished()
Undocumented in source. Be warned that the author may not have intended to support it.
onDraw
void onDraw(DrawBuf buf)

Draw widget at its position to buffer

onKeyEvent
bool onKeyEvent(KeyEvent event)

Handle keys

setCupState
void setCupState(CupState state)

change game state, init state animation when necessary

setLevel
void setLevel(int level)

set difficulty level 1..10

Properties

animating
bool animating [@property getter]

returns true is widget is being animated - need to call animate() and redraw

falling
bool falling [@property getter]

returns true if figure is in falling - movement state

Static variables

LEVEL_SPEED
int[10] LEVEL_SPEED;
Undocumented in source.
MIN_FAST_FALLING_INTERVAL
int MIN_FAST_FALLING_INTERVAL;
Undocumented in source.
NEXT_LEVEL_SCORE
int[] NEXT_LEVEL_SCORE;
Undocumented in source.
RESERVED_ROWS
int RESERVED_ROWS;
Undocumented in source.
ROWS_FALLING_INTERVAL
int ROWS_FALLING_INTERVAL;
Undocumented in source.

Variables

_animation
AnimationHelper _animation;

animation helper for fade and movement in different states

_cols
int _cols;

cup columns count

_cup
Cup _cup;

cup data

_fastDownFlag
bool _fastDownFlag;

When true, figure is falling down fast

_level
int _level;

Level 1..10

_movementDuration
long _movementDuration;

Single cell movement duration for current level, in 1/10000000 of seconds

_rows
int _rows;

cup rows count

_score
int _score;

Score

_state
CupState _state;

Current state

_totalRowsDestroyed
int _totalRowsDestroyed;
Undocumented in source.

Meta