From af181d9fedd13b73597ad6650f00a25cbff1492b Mon Sep 17 00:00:00 2001 From: Andi Machovec Date: Tue, 28 Dec 2021 16:41:47 +0100 Subject: [PATCH] added visual marker for active row --- src/boardview.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/boardview.cpp b/src/boardview.cpp index 31cb1bf..0006de2 100644 --- a/src/boardview.cpp +++ b/src/boardview.cpp @@ -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) @@ -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); + } + }