Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Fix positioning and size of the scoreboard panel #101

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/game/components/score_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ScoreBox extends PositionComponent
void onLoad() {
final availableHeight = game.size.y - 2 * screenMargin;
size = Vector2(scoreBoxWidth, availableHeight / maxShips - scoreBoxMargin);
rRect = RRect.fromRectAndRadius(Vector2.zero() & size, _radius);
rRect = RRect.fromRectAndRadius(Vector2(scoreBoxMargin, 0) & size, _radius);
}

@override
Expand Down
5 changes: 3 additions & 2 deletions lib/game/components/score_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class ScorePanel extends RectangleComponent
with HasGameReference<LightRunnersGame> {
@override
void onLoad() {
position = Vector2(fixedSize.x - scoreBoxWidth, 0) - fixedSize / 2;
size = Vector2(scoreBoxWidth, fixedSize.y);
final left = fixedSize.x - scoreBoxWidth - 2 * scoreBoxMargin;
position = Vector2(left, screenMargin) - fixedSize / 2;
size = Vector2(scoreBoxWidth, fixedSize.y - screenMargin * 2);
paint = Paint()..color = GamePalette.black;
addAll(
game.ships.values.map(
Expand Down
Loading