Browse Source

Button/text colours are now based on the BG colour

git-svn-id: http://chris.smith.name/svn/japoker/trunk@6 b8598caf-53df-4c1b-98b8-507a84a220
tags/v12
Chris Smith 16 years ago
parent
commit
7d889060ef
59 changed files with 16 additions and 14 deletions
  1. BIN
      src/com/md87/cardgame/res/fronts/classic/cace.png
  2. BIN
      src/com/md87/cardgame/res/fronts/classic/cdeuce.png
  3. BIN
      src/com/md87/cardgame/res/fronts/classic/ceight.png
  4. BIN
      src/com/md87/cardgame/res/fronts/classic/cfive.png
  5. BIN
      src/com/md87/cardgame/res/fronts/classic/cfour.png
  6. BIN
      src/com/md87/cardgame/res/fronts/classic/cjack.png
  7. BIN
      src/com/md87/cardgame/res/fronts/classic/cking.png
  8. BIN
      src/com/md87/cardgame/res/fronts/classic/cnine.png
  9. BIN
      src/com/md87/cardgame/res/fronts/classic/cqueen.png
  10. BIN
      src/com/md87/cardgame/res/fronts/classic/cseven.png
  11. BIN
      src/com/md87/cardgame/res/fronts/classic/csix.png
  12. BIN
      src/com/md87/cardgame/res/fronts/classic/cten.png
  13. BIN
      src/com/md87/cardgame/res/fronts/classic/cthree.png
  14. BIN
      src/com/md87/cardgame/res/fronts/classic/dace.png
  15. BIN
      src/com/md87/cardgame/res/fronts/classic/ddeuce.png
  16. BIN
      src/com/md87/cardgame/res/fronts/classic/deight.png
  17. BIN
      src/com/md87/cardgame/res/fronts/classic/dfive.png
  18. BIN
      src/com/md87/cardgame/res/fronts/classic/dfour.png
  19. BIN
      src/com/md87/cardgame/res/fronts/classic/djack.png
  20. BIN
      src/com/md87/cardgame/res/fronts/classic/dking.png
  21. BIN
      src/com/md87/cardgame/res/fronts/classic/dnine.png
  22. BIN
      src/com/md87/cardgame/res/fronts/classic/dqueen.png
  23. BIN
      src/com/md87/cardgame/res/fronts/classic/dseven.png
  24. BIN
      src/com/md87/cardgame/res/fronts/classic/dsix.png
  25. BIN
      src/com/md87/cardgame/res/fronts/classic/dten.png
  26. BIN
      src/com/md87/cardgame/res/fronts/classic/dthree.png
  27. BIN
      src/com/md87/cardgame/res/fronts/classic/hace.png
  28. BIN
      src/com/md87/cardgame/res/fronts/classic/hdeuce.png
  29. BIN
      src/com/md87/cardgame/res/fronts/classic/height.png
  30. BIN
      src/com/md87/cardgame/res/fronts/classic/hfive.png
  31. BIN
      src/com/md87/cardgame/res/fronts/classic/hfour.png
  32. BIN
      src/com/md87/cardgame/res/fronts/classic/hjack.png
  33. BIN
      src/com/md87/cardgame/res/fronts/classic/hking.png
  34. BIN
      src/com/md87/cardgame/res/fronts/classic/hnine.png
  35. BIN
      src/com/md87/cardgame/res/fronts/classic/hqueen.png
  36. BIN
      src/com/md87/cardgame/res/fronts/classic/hseven.png
  37. BIN
      src/com/md87/cardgame/res/fronts/classic/hsix.png
  38. BIN
      src/com/md87/cardgame/res/fronts/classic/hten.png
  39. BIN
      src/com/md87/cardgame/res/fronts/classic/hthree.png
  40. BIN
      src/com/md87/cardgame/res/fronts/classic/sace.png
  41. BIN
      src/com/md87/cardgame/res/fronts/classic/sdeuce.png
  42. BIN
      src/com/md87/cardgame/res/fronts/classic/seight.png
  43. BIN
      src/com/md87/cardgame/res/fronts/classic/sfive.png
  44. BIN
      src/com/md87/cardgame/res/fronts/classic/sfour.png
  45. BIN
      src/com/md87/cardgame/res/fronts/classic/sjack.png
  46. BIN
      src/com/md87/cardgame/res/fronts/classic/sking.png
  47. BIN
      src/com/md87/cardgame/res/fronts/classic/snine.png
  48. BIN
      src/com/md87/cardgame/res/fronts/classic/squeen.png
  49. BIN
      src/com/md87/cardgame/res/fronts/classic/sseven.png
  50. BIN
      src/com/md87/cardgame/res/fronts/classic/ssix.png
  51. BIN
      src/com/md87/cardgame/res/fronts/classic/sten.png
  52. BIN
      src/com/md87/cardgame/res/fronts/classic/sthree.png
  53. BIN
      src/com/md87/cardgame/res/icons/icon.png
  54. BIN
      src/com/md87/cardgame/res/icons/money.png
  55. BIN
      src/com/md87/cardgame/res/icons/save.png
  56. BIN
      src/com/md87/cardgame/res/icons/style.png
  57. BIN
      src/com/md87/cardgame/res/icons/user.png
  58. 7
    5
      src/com/md87/cardgame/ui/Button.java
  59. 9
    9
      src/com/md87/cardgame/ui/GameWindow.java

BIN
src/com/md87/cardgame/res/fronts/classic/cace.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cdeuce.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/ceight.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cfive.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cfour.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cjack.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cking.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cnine.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cqueen.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cseven.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/csix.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cten.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/cthree.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dace.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/ddeuce.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/deight.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dfive.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dfour.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/djack.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dking.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dnine.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dqueen.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dseven.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dsix.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dten.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/dthree.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hace.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hdeuce.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/height.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hfive.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hfour.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hjack.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hking.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hnine.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hqueen.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hseven.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hsix.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hten.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/hthree.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sace.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sdeuce.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/seight.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sfive.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sfour.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sjack.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sking.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/snine.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/squeen.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sseven.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/ssix.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sten.png View File


BIN
src/com/md87/cardgame/res/fronts/classic/sthree.png View File


BIN
src/com/md87/cardgame/res/icons/icon.png View File


BIN
src/com/md87/cardgame/res/icons/money.png View File


BIN
src/com/md87/cardgame/res/icons/save.png View File


BIN
src/com/md87/cardgame/res/icons/style.png View File


BIN
src/com/md87/cardgame/res/icons/user.png View File


+ 7
- 5
src/com/md87/cardgame/ui/Button.java View File

@@ -1,5 +1,5 @@
1 1
 /*
2
- * Copyright (c) Chris 'MD87' Smith, 2007. All rights reserved.
2
+ * Copyright (c) Chris 'MD87' Smith, 2007-2008. All rights reserved.
3 3
  *
4 4
  * This code may not be redistributed without prior permission from the
5 5
  * aforementioned copyright holder(s).
@@ -21,8 +21,8 @@ import java.awt.geom.Rectangle2D;
21 21
  */
22 22
 public class Button {
23 23
     
24
-    private final static Color BUTTON_ACTIVE = new Color(0, 200, 0);
25
-    private final static Color BUTTON_INACTIVE = new Color(0, 150, 0);    
24
+    private final Color activeColour;
25
+    private final Color inactiveColour;
26 26
     
27 27
     public static enum TYPE {
28 28
         SLOW {
@@ -97,9 +97,11 @@ public class Button {
97 97
     private String text;
98 98
     private Rectangle bounds;
99 99
     
100
-    public Button(final String text, final Rectangle bounds) {
100
+    public Button(final String text, final Rectangle bounds, final Color base) {
101 101
         this.text = text;
102 102
         this.bounds = bounds;
103
+        this.inactiveColour = base.brighter();
104
+        this.activeColour = this.inactiveColour.brighter();
103 105
     }
104 106
     
105 107
     public String getText() {
@@ -115,7 +117,7 @@ public class Button {
115 117
     }
116 118
     
117 119
     public void render(final Graphics2D g, final boolean enabled) {
118
-        g.setColor(enabled ? BUTTON_ACTIVE : BUTTON_INACTIVE);
120
+        g.setColor(enabled ? activeColour : inactiveColour);
119 121
         g.drawRoundRect(bounds.x, bounds.y, bounds.width, bounds.height, 5, 5);
120 122
 
121 123
         renderTextCentered(g);

+ 9
- 9
src/com/md87/cardgame/ui/GameWindow.java View File

@@ -209,29 +209,29 @@ public class GameWindow extends JFrame implements GameObserver, MouseListener, K
209 209
 
210 210
         buttons.put(Button.TYPE.FAST, new Button("Fast",
211 211
                 new Rectangle(BUTTON_OFFSET, topButton + 0 * buttonOffset, BUTTON_WIDTH,
212
-                BUTTON_HEIGHT)));
212
+                BUTTON_HEIGHT), backgroundColour));
213 213
         buttons.put(Button.TYPE.NORMAL, new Button("Medium",
214 214
                 new Rectangle(BUTTON_OFFSET, topButton + 1 * buttonOffset, BUTTON_WIDTH,
215
-                BUTTON_HEIGHT)));
215
+                BUTTON_HEIGHT), backgroundColour));
216 216
         buttons.put(Button.TYPE.SLOW, new Button("Slow",
217 217
                 new Rectangle(BUTTON_OFFSET, topButton + 2 * buttonOffset, BUTTON_WIDTH,
218
-                BUTTON_HEIGHT)));
218
+                BUTTON_HEIGHT), backgroundColour));
219 219
         buttons.put(Button.TYPE.CONTINUE, new Button("Continue",
220 220
                 new Rectangle(BUTTON_OFFSET, topButton + 3 * buttonOffset, BUTTON_WIDTH,
221
-                BUTTON_HEIGHT)));
221
+                BUTTON_HEIGHT), backgroundColour));
222 222
 
223 223
         buttons.put(Button.TYPE.CHECK, new Button("Check / Call",
224 224
                 new Rectangle(rightButton, topButton + 0 * buttonOffset, BUTTON_WIDTH,
225
-                BUTTON_HEIGHT)));
225
+                BUTTON_HEIGHT), backgroundColour));
226 226
         buttons.put(Button.TYPE.OPEN, new Button("Open / Raise",
227 227
                 new Rectangle(rightButton, topButton + 1 * buttonOffset, BUTTON_WIDTH,
228
-                BUTTON_HEIGHT)));
228
+                BUTTON_HEIGHT), backgroundColour));
229 229
         buttons.put(Button.TYPE.FOLD, new Button("Fold",
230 230
                 new Rectangle(rightButton, topButton + 2 * buttonOffset, BUTTON_WIDTH,
231
-                BUTTON_HEIGHT)));
231
+                BUTTON_HEIGHT), backgroundColour));
232 232
         buttons.put(Button.TYPE.DISCARD, new Button("Discard",
233 233
                 new Rectangle(rightButton, topButton + 3 * buttonOffset, BUTTON_WIDTH,
234
-                BUTTON_HEIGHT)));
234
+                BUTTON_HEIGHT), backgroundColour));
235 235
     }
236 236
 
237 237
     /**
@@ -339,7 +339,7 @@ public class GameWindow extends JFrame implements GameObserver, MouseListener, K
339 339
                 nextCardPos.put(myPlayer, new Point(x + xOffset, yCardPosition));
340 340
 
341 341
                 if (inShowdown && !myPlayer.hasFolded() && myPlayer.getCards().size() > 0) {
342
-                    g.setColor(Color.GREEN);
342
+                    g.setColor(backgroundColour.brighter().brighter());
343 343
                     String[] hand = game.getHandText(myPlayer).split("\n");
344 344
                     int yo = 0;
345 345
                     for (String line : hand) {

Loading…
Cancel
Save