tetris: print user name above score #421

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

@ -31,7 +31,7 @@ void DrawBoard() {
}
channels_set_fg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
board_->set_base(channels, 0, "");
scoreplane_ = std::make_unique<ncpp::Plane>(1, 20, y - BOARD_HEIGHT, 2, nullptr);
scoreplane_ = std::make_unique<ncpp::Plane>(2, 20, y - BOARD_HEIGHT, 2, nullptr);
if(!scoreplane_){
throw TetrisNotcursesErr("Plane()");
}
@ -41,8 +41,10 @@ void DrawBoard() {
if(!scoreplane_->set_base(scorechan, 0, "")){
throw TetrisNotcursesErr("set_base()");
}
scoreplane_->set_fg(0x00d0a0);
scoreplane_->set_bg_alpha(CELL_ALPHA_TRANSPARENT);
scoreplane_->set_fg(0xd040d0);
scoreplane_->printf(0, 1, "%s", cuserid(nullptr));
scoreplane_->set_fg(0x00d0a0);
UpdateScore();
if(!nc_.render()){
throw TetrisNotcursesErr("render()");

@ -1,5 +1,5 @@
void UpdateScore(){
if(scoreplane_->printf(0, 0, "level: %02d score: %ju", level_, static_cast<uintmax_t>(score_)) < 0){
if(scoreplane_->printf(1, 0, "level: %02d score: %ju", level_, static_cast<uintmax_t>(score_)) < 0){
throw TetrisNotcursesErr("printf()");
}
}

Loading…
Cancel
Save