Skip to content

Commit

Permalink
added visual marker for active row
Browse files Browse the repository at this point in the history
  • Loading branch information
andimachovec committed Dec 28, 2021
1 parent 76d415c commit af181d9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/boardview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,12 @@ BoardView::MessageReceived(BMessage *msg)
void
BoardView::Draw(BRect updateRect)
{

// background
SetLowColor(104, 62, 28);
FillRect(updateRect, B_SOLID_LOW);


// pegs
for(int row = 0; row < 9; ++row)
{
for(int peg_nr = 0; peg_nr < 4; ++peg_nr)
Expand All @@ -203,6 +205,23 @@ BoardView::Draw(BRect updateRect)
}
}

// active row marker
if (!fGameOver)
{
BRect marker_rect;
BPoint left_point = fRows[fActiveRow]->GetColorPeg(0)->GetCenter();
BPoint right_point = fRows[fActiveRow]->GetColorPeg(3)->GetCenter();
uint8 marker_margin = 5;

marker_rect.top = left_point.y - fColorPegRadius - marker_margin;
marker_rect.left = left_point.x - fColorPegRadius - marker_margin;
marker_rect.bottom = left_point.y + fColorPegRadius + marker_margin;
marker_rect.right = right_point.x + fColorPegRadius + marker_margin;

SetHighColor(246,226,155);
StrokeRect(marker_rect, B_SOLID_HIGH);
}

}


Expand Down

0 comments on commit af181d9

Please sign in to comment.