game timer: Add chess-style buffer time option (#10598)

* UI Changes

* Add new buffer time options

* Main functionality

* Final implementation

Also added player UI for when they are using their buffer time (timer turns green)
This commit is contained in:
Alexander Novotny 2023-07-28 22:05:21 -04:00 committed by GitHub
parent b7543af939
commit 519b3988be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 273 additions and 16 deletions

View file

@ -57,6 +57,7 @@ public class HoverButton extends JPanel implements MouseListener {
private Command observer = null;
private Command onHover = null;
private Color textColor = Color.white;
private Color topTextColor = null;
private final Rectangle centerTextArea = new Rectangle(5, 18, 75, 40);
private Color centerTextColor = new Color(200, 210, 0, 200);
private Color origCenterTextColor = new Color(200, 210, 0, 200);
@ -152,7 +153,7 @@ public class HoverButton extends JPanel implements MouseListener {
topTextOffsetX = calculateOffsetForTop(g2d, topText);
g2d.setColor(textBGColor);
g2d.drawString(topText, topTextOffsetX + 1, 14);
g2d.setColor(textColor);
g2d.setColor(topTextColor != null ? topTextColor : textColor);
g2d.drawString(topText, topTextOffsetX, 13);
}
if (topTextImage != null) {
@ -235,6 +236,15 @@ public class HoverButton extends JPanel implements MouseListener {
this.textColor = textColor;
}
/**
* Overrides textColor for the upper text if non-null.
* If null, return back to textColor.
* @param textColor
*/
public void setTopTextColor(Color textColor) {
this.topTextColor = textColor;
}
public void setOverlayImage(Image image) {
this.overlayImage = image;
this.overlayImageSize = new Dimension(image.getWidth(null), image.getHeight(null));