CupWidget

Cup widget

Members

Functions

animate
void animate(long interval)

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

drawCell
void drawCell(DrawBuf buf, Rect cellRc, uint color, int offset = 0)

draw cup cell

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

draw figure

handleAction
bool handleAction(const Action a)

override to handle specific actions

handleFastDown
bool handleFastDown(bool fast)

Turn on / off fast falling down

init
void init(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

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

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

Meta