Tetris: gradient stain on fixed pieces #421

pull/426/head
nick black 4 years ago
parent 5864b37d0a
commit d491d532bb
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -12,6 +12,7 @@ void DrawBackground(const std::string& s) {
if(backg_->render(0, 0, -1, -1) <= 0){
throw TetrisNotcursesErr("render(): " + s);
}
backg_->get_plane()->greyscale();
}
// draw the background on the standard plane, then create a new plane for the play area.

@ -8,13 +8,34 @@ bool MoveDown() {
return true;
}
curpiece_->mergedown(*board_);
if(!board_->cursor_move(0, 1)){
throw TetrisNotcursesErr("cursor_move()");
}
int bdimy, bdimx;
board_->get_dim(&bdimy, &bdimx);
uint64_t tl, tr, bl, br;
tl = tr = bl = br = 0;
channels_set_bg_alpha(&tl, CELL_ALPHA_TRANSPARENT);
channels_set_bg_alpha(&tr, CELL_ALPHA_TRANSPARENT);
channels_set_bg_alpha(&bl, CELL_ALPHA_TRANSPARENT);
channels_set_bg_alpha(&br, CELL_ALPHA_TRANSPARENT);
channels_set_fg(&tl, 0xff0000);
channels_set_fg(&tr, 0x00ff00);
channels_set_fg(&bl, 0x0000ff);
channels_set_fg(&br, 0x00ffff);
if(!board_->stain(bdimy - 2, bdimx - 2, tl, tr, bl, br)){
throw TetrisNotcursesErr("stain()");
}
curpiece_ = NewPiece();
}else{
++y;
if(!curpiece_->move(y, x) || !nc_.render()){
throw TetrisNotcursesErr("move() or render()");
if(!curpiece_->move(y, x)){
throw TetrisNotcursesErr("move()");
}
}
if(!nc_.render()){
throw TetrisNotcursesErr("render()");
}
}
return false;
}

Loading…
Cancel
Save