mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
Tetris: gradient stain on fixed pieces #421
This commit is contained in:
parent
5864b37d0a
commit
d491d532bb
@ -12,6 +12,7 @@ void DrawBackground(const std::string& s) {
|
|||||||
if(backg_->render(0, 0, -1, -1) <= 0){
|
if(backg_->render(0, 0, -1, -1) <= 0){
|
||||||
throw TetrisNotcursesErr("render(): " + s);
|
throw TetrisNotcursesErr("render(): " + s);
|
||||||
}
|
}
|
||||||
|
backg_->get_plane()->greyscale();
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the background on the standard plane, then create a new plane for the play area.
|
// draw the background on the standard plane, then create a new plane for the play area.
|
||||||
|
@ -8,13 +8,34 @@ bool MoveDown() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
curpiece_->mergedown(*board_);
|
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();
|
curpiece_ = NewPiece();
|
||||||
}else{
|
}else{
|
||||||
++y;
|
++y;
|
||||||
if(!curpiece_->move(y, x) || !nc_.render()){
|
if(!curpiece_->move(y, x)){
|
||||||
throw TetrisNotcursesErr("move() or render()");
|
throw TetrisNotcursesErr("move()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!nc_.render()){
|
||||||
|
throw TetrisNotcursesErr("render()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user