Tetris: render after creating a new piece

pull/426/head
nick black 4 years ago
parent 013e445209
commit 25dd65a172
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -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…
Cancel
Save