Tetris: render after creating a new piece

This commit is contained in:
nick black 2020-03-25 21:44:53 -04:00
parent 013e445209
commit 25dd65a172
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 5 additions and 2 deletions

View File

@ -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, "");

View File

@ -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;
}