mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
Tetris: render after creating a new piece
This commit is contained in:
parent
013e445209
commit
25dd65a172
@ -26,7 +26,7 @@ void DrawBoard() {
|
||||
channels_set_fg(&channels, 0x00b040);
|
||||
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
|
||||
if(!board_->double_box(0, channels, BOARD_HEIGHT - 1, BOARD_WIDTH * 2 - 1, NCBOXMASK_TOP)){
|
||||
throw TetrisNotcursesErr("rounded_box()");
|
||||
throw TetrisNotcursesErr("double_box()");
|
||||
}
|
||||
channels_set_fg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
|
||||
board_->set_base(channels, 0, "");
|
||||
|
@ -32,11 +32,14 @@ std::unique_ptr<ncpp::Plane> NewPiece() {
|
||||
for(size_t i = 0 ; i < strlen(t->texture) ; ++i){
|
||||
if(t->texture[i] == '*'){
|
||||
if(n->putstr(y, x, "██") < 0){
|
||||
return NULL;
|
||||
throw TetrisNotcursesErr("putstr()");
|
||||
}
|
||||
}
|
||||
y += ((x = ((x + 2) % cols)) == 0);
|
||||
}
|
||||
}
|
||||
if(notcurses_render(nc_)){
|
||||
throw TetrisNotcursesErr("render()");
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user