Browse Source

Can now alter card style and background colour

git-svn-id: http://chris.smith.name/svn/japoker/trunk@4 b8598caf-53df-4c1b-98b8-507a84a220
tags/v12
Chris Smith 16 years ago
parent
commit
01f913c352
100 changed files with 1247 additions and 19 deletions
  1. 2
    2
      nbproject/private/private.properties
  2. 176
    0
      src/com/md87/cardgame/config/AppearancePanel.java
  3. 15
    9
      src/com/md87/cardgame/config/ConfigScreen.java
  4. 1
    1
      src/com/md87/cardgame/config/PlayerPanel.java
  5. 27
    0
      src/com/md87/cardgame/config/cards/CardStyle.java
  6. 23
    0
      src/com/md87/cardgame/config/cards/ClassicBack1.java
  7. 23
    0
      src/com/md87/cardgame/config/cards/ClassicBack2.java
  8. 23
    0
      src/com/md87/cardgame/config/cards/ClassicFront1.java
  9. 23
    0
      src/com/md87/cardgame/config/cards/ClassicFront2.java
  10. 23
    0
      src/com/md87/cardgame/config/cards/OcaBlueCardsBack.java
  11. 23
    0
      src/com/md87/cardgame/config/cards/OcaBlueHatchBack.java
  12. 23
    0
      src/com/md87/cardgame/config/cards/OcaBlueSuits1Back.java
  13. 23
    0
      src/com/md87/cardgame/config/cards/OcaBlueSuits2Back.java
  14. 23
    0
      src/com/md87/cardgame/config/cards/OcaRedCardsBack.java
  15. 23
    0
      src/com/md87/cardgame/config/cards/OcaRedHatchBack.java
  16. 23
    0
      src/com/md87/cardgame/config/cards/OcaRedSuits1Back.java
  17. 23
    0
      src/com/md87/cardgame/config/cards/OcaRedSuits2Back.java
  18. 23
    0
      src/com/md87/cardgame/config/cards/OcaWhiteFront.java
  19. 24
    6
      src/com/md87/cardgame/controllers/RandomPlayer.java
  20. 1
    1
      src/com/md87/cardgame/interfaces/PlayerController.java
  21. BIN
      src/com/md87/cardgame/res/backs/classic1.png
  22. BIN
      src/com/md87/cardgame/res/backs/classic2.png
  23. BIN
      src/com/md87/cardgame/res/backs/ocabluecards.png
  24. BIN
      src/com/md87/cardgame/res/backs/ocabluehatch.png
  25. BIN
      src/com/md87/cardgame/res/backs/ocabluesuits1.png
  26. BIN
      src/com/md87/cardgame/res/backs/ocabluesuits2.png
  27. BIN
      src/com/md87/cardgame/res/backs/ocaredcards.png
  28. BIN
      src/com/md87/cardgame/res/backs/ocaredhatch.png
  29. BIN
      src/com/md87/cardgame/res/backs/ocaredsuits1.png
  30. BIN
      src/com/md87/cardgame/res/backs/ocaredsuits2.png
  31. BIN
      src/com/md87/cardgame/res/fronts/classic2/cace.png
  32. BIN
      src/com/md87/cardgame/res/fronts/classic2/cdeuce.png
  33. BIN
      src/com/md87/cardgame/res/fronts/classic2/ceight.png
  34. BIN
      src/com/md87/cardgame/res/fronts/classic2/cfive.png
  35. BIN
      src/com/md87/cardgame/res/fronts/classic2/cfour.png
  36. BIN
      src/com/md87/cardgame/res/fronts/classic2/cjack.png
  37. BIN
      src/com/md87/cardgame/res/fronts/classic2/cking.png
  38. BIN
      src/com/md87/cardgame/res/fronts/classic2/cnine.png
  39. BIN
      src/com/md87/cardgame/res/fronts/classic2/cqueen.png
  40. BIN
      src/com/md87/cardgame/res/fronts/classic2/cseven.png
  41. BIN
      src/com/md87/cardgame/res/fronts/classic2/csix.png
  42. BIN
      src/com/md87/cardgame/res/fronts/classic2/cten.png
  43. BIN
      src/com/md87/cardgame/res/fronts/classic2/cthree.png
  44. BIN
      src/com/md87/cardgame/res/fronts/classic2/dace.png
  45. BIN
      src/com/md87/cardgame/res/fronts/classic2/ddeuce.png
  46. BIN
      src/com/md87/cardgame/res/fronts/classic2/deight.png
  47. BIN
      src/com/md87/cardgame/res/fronts/classic2/dfive.png
  48. BIN
      src/com/md87/cardgame/res/fronts/classic2/dfour.png
  49. BIN
      src/com/md87/cardgame/res/fronts/classic2/djack.png
  50. BIN
      src/com/md87/cardgame/res/fronts/classic2/dking.png
  51. BIN
      src/com/md87/cardgame/res/fronts/classic2/dnine.png
  52. BIN
      src/com/md87/cardgame/res/fronts/classic2/dqueen.png
  53. BIN
      src/com/md87/cardgame/res/fronts/classic2/dseven.png
  54. BIN
      src/com/md87/cardgame/res/fronts/classic2/dsix.png
  55. BIN
      src/com/md87/cardgame/res/fronts/classic2/dten.png
  56. BIN
      src/com/md87/cardgame/res/fronts/classic2/dthree.png
  57. BIN
      src/com/md87/cardgame/res/fronts/classic2/hace.png
  58. BIN
      src/com/md87/cardgame/res/fronts/classic2/hdeuce.png
  59. BIN
      src/com/md87/cardgame/res/fronts/classic2/height.png
  60. BIN
      src/com/md87/cardgame/res/fronts/classic2/hfive.png
  61. BIN
      src/com/md87/cardgame/res/fronts/classic2/hfour.png
  62. BIN
      src/com/md87/cardgame/res/fronts/classic2/hjack.png
  63. BIN
      src/com/md87/cardgame/res/fronts/classic2/hking.png
  64. BIN
      src/com/md87/cardgame/res/fronts/classic2/hnine.png
  65. BIN
      src/com/md87/cardgame/res/fronts/classic2/hqueen.png
  66. BIN
      src/com/md87/cardgame/res/fronts/classic2/hseven.png
  67. BIN
      src/com/md87/cardgame/res/fronts/classic2/hsix.png
  68. BIN
      src/com/md87/cardgame/res/fronts/classic2/hten.png
  69. BIN
      src/com/md87/cardgame/res/fronts/classic2/hthree.png
  70. BIN
      src/com/md87/cardgame/res/fronts/classic2/sace.png
  71. BIN
      src/com/md87/cardgame/res/fronts/classic2/sdeuce.png
  72. BIN
      src/com/md87/cardgame/res/fronts/classic2/seight.png
  73. BIN
      src/com/md87/cardgame/res/fronts/classic2/sfive.png
  74. BIN
      src/com/md87/cardgame/res/fronts/classic2/sfour.png
  75. 234
    0
      src/com/md87/cardgame/res/fronts/classic2/sjack.png
  76. BIN
      src/com/md87/cardgame/res/fronts/classic2/sking.png
  77. 234
    0
      src/com/md87/cardgame/res/fronts/classic2/snine.png
  78. BIN
      src/com/md87/cardgame/res/fronts/classic2/squeen.png
  79. BIN
      src/com/md87/cardgame/res/fronts/classic2/sseven.png
  80. BIN
      src/com/md87/cardgame/res/fronts/classic2/ssix.png
  81. 234
    0
      src/com/md87/cardgame/res/fronts/classic2/sten.png
  82. BIN
      src/com/md87/cardgame/res/fronts/classic2/sthree.png
  83. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cace.png
  84. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cdeuce.png
  85. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/ceight.png
  86. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cfive.png
  87. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cfour.png
  88. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cjack.png
  89. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cking.png
  90. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cnine.png
  91. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cqueen.png
  92. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cseven.png
  93. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/csix.png
  94. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cten.png
  95. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/cthree.png
  96. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/dace.png
  97. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/ddeuce.png
  98. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/deight.png
  99. BIN
      src/com/md87/cardgame/res/fronts/ocawhite/dfive.png
  100. 0
    0
      src/com/md87/cardgame/res/fronts/ocawhite/dfour.png

+ 2
- 2
nbproject/private/private.properties View File

@@ -1,4 +1,4 @@
1 1
 javac.debug=true
2 2
 javadoc.preview=true
3
-jaxws.endorsed.dir=/usr/local/netbeans-6.0/java1/modules/ext/jaxws21/api
4
-user.properties.file=/home/chris/.netbeans/6.0/build.properties
3
+jaxws.endorsed.dir=/usr/local/netbeans-6.1/java2/modules/ext/jaxws21/api
4
+user.properties.file=/home/chris/.netbeans/6.1/build.properties

+ 176
- 0
src/com/md87/cardgame/config/AppearancePanel.java View File

@@ -0,0 +1,176 @@
1
+/*
2
+ * Copyright (c) Chris 'MD87' Smith, 2007-2008. All rights reserved.
3
+ *
4
+ * This code may not be redistributed without prior permission from the
5
+ * aforementioned copyright holder(s).
6
+ */
7
+
8
+package com.md87.cardgame.config;
9
+
10
+import com.md87.cardgame.config.cards.*;
11
+
12
+import java.awt.Color;
13
+import java.awt.Graphics;
14
+import java.awt.Graphics2D;
15
+import java.awt.event.ActionEvent;
16
+import java.awt.event.ActionListener;
17
+import java.awt.image.BufferedImage;
18
+import java.io.IOException;
19
+
20
+import javax.imageio.ImageIO;
21
+import javax.swing.BorderFactory;
22
+import javax.swing.JComboBox;
23
+import javax.swing.JLabel;
24
+import javax.swing.JPanel;
25
+import javax.swing.JSpinner;
26
+import javax.swing.SpinnerNumberModel;
27
+import javax.swing.event.ChangeEvent;
28
+import javax.swing.event.ChangeListener;
29
+
30
+import net.miginfocom.swing.MigLayout;
31
+
32
+/**
33
+ *
34
+ * @author Chris
35
+ */
36
+public class AppearancePanel extends JPanel implements ActionListener, ChangeListener {
37
+
38
+    private static final long serialVersionUID = 1;
39
+    
40
+    private final PreviewPanel preview = new PreviewPanel();
41
+    
42
+    private final JComboBox frontCombo = new JComboBox();
43
+    private final JComboBox backCombo = new JComboBox();
44
+    
45
+    private final JSpinner redSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 255, 1));
46
+    private final JSpinner greenSpinner = new JSpinner(new SpinnerNumberModel(100, 0, 255, 1));
47
+    private final JSpinner blueSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 255, 1));
48
+
49
+    public AppearancePanel() {
50
+        setLayout(new MigLayout("fill"));
51
+        
52
+        frontCombo.addItem(new ClassicFront1());
53
+        frontCombo.addItem(new ClassicFront2());
54
+        frontCombo.addItem(new OcaWhiteFront());
55
+        
56
+        backCombo.addItem(new ClassicBack1());
57
+        backCombo.addItem(new ClassicBack2());
58
+        backCombo.addItem(new OcaBlueHatchBack());
59
+        backCombo.addItem(new OcaRedHatchBack());
60
+        backCombo.addItem(new OcaBlueCardsBack());
61
+        backCombo.addItem(new OcaRedCardsBack());
62
+        backCombo.addItem(new OcaBlueSuits1Back());
63
+        backCombo.addItem(new OcaBlueSuits2Back());
64
+        backCombo.addItem(new OcaRedSuits1Back());
65
+        backCombo.addItem(new OcaRedSuits2Back());
66
+        
67
+        frontCombo.addActionListener(this);
68
+        backCombo.addActionListener(this);
69
+        
70
+        redSpinner.addChangeListener(this);
71
+        greenSpinner.addChangeListener(this);
72
+        blueSpinner.addChangeListener(this);
73
+        
74
+        final JPanel optionsPanel = new JPanel();
75
+        final JPanel previewPanel = new JPanel();        
76
+        final JPanel colourPanel = new JPanel();
77
+        
78
+        optionsPanel.setBorder(BorderFactory.createTitledBorder("Card style"));
79
+        optionsPanel.setLayout(new MigLayout("fillx"));
80
+        optionsPanel.add(new JLabel("Front:"));
81
+        optionsPanel.add(frontCombo, "growx");
82
+        optionsPanel.add(new JLabel("Back:"));
83
+        optionsPanel.add(backCombo, "growx");
84
+        
85
+        colourPanel.setBorder(BorderFactory.createTitledBorder("Background colour"));
86
+        colourPanel.setLayout(new MigLayout("fillx"));
87
+        colourPanel.add(new JLabel("Red:"));
88
+        colourPanel.add(redSpinner, "growx");
89
+        colourPanel.add(new JLabel("Green:"));
90
+        colourPanel.add(greenSpinner, "growx");
91
+        colourPanel.add(new JLabel("Blue:"));
92
+        colourPanel.add(blueSpinner, "growx");
93
+        
94
+        previewPanel.setBorder(BorderFactory.createTitledBorder("Preview"));
95
+        previewPanel.setLayout(new MigLayout());
96
+        previewPanel.add(preview, "grow, push");
97
+        
98
+        add(optionsPanel, "growx, wrap");
99
+        add(colourPanel, "growx, wrap");
100
+        add(previewPanel, "growx, growy");
101
+    }
102
+
103
+    /** {@inheritDoc} */
104
+    @Override
105
+    public void actionPerformed(final ActionEvent e) {
106
+        preview.repaint();
107
+    }
108
+    
109
+    /** {@inheritDoc} */
110
+    @Override
111
+    public void stateChanged(final ChangeEvent e) {
112
+        preview.repaint();
113
+    }
114
+    
115
+    public String getBackName() {
116
+        return ((CardStyle) backCombo.getSelectedItem()).getFolderName();
117
+    }
118
+    
119
+    public String getFrontName() {
120
+        return ((CardStyle) frontCombo.getSelectedItem()).getFolderName();
121
+    }
122
+    
123
+    public Color getColour() {
124
+        return new Color((Integer) redSpinner.getValue(),
125
+                (Integer) greenSpinner.getValue(), (Integer) blueSpinner.getValue());
126
+    }
127
+
128
+    private class PreviewPanel extends JPanel {
129
+
130
+        public PreviewPanel() {
131
+            super(new MigLayout("fill"));
132
+        }
133
+
134
+        @Override
135
+        public void paint(final Graphics g) {
136
+            g.setColor(AppearancePanel.this.getColour());
137
+            g.fillRect(0, 0, getWidth(), getHeight());
138
+            
139
+            final String backFile = "/com/md87/cardgame/res/backs/"
140
+                    + ((CardStyle) backCombo.getSelectedItem()).getFolderName() + ".png";
141
+            final String frontFile1 = "/com/md87/cardgame/res/fronts/"
142
+                    + ((CardStyle) frontCombo.getSelectedItem()).getFolderName() + "/sace.png";
143
+            final String frontFile2 = "/com/md87/cardgame/res/fronts/"
144
+                    + ((CardStyle) frontCombo.getSelectedItem()).getFolderName() + "/hdeuce.png";
145
+            final String frontFile3 = "/com/md87/cardgame/res/fronts/"
146
+                    + ((CardStyle) frontCombo.getSelectedItem()).getFolderName() + "/djack.png";
147
+
148
+            try {
149
+                final BufferedImage front1 = ImageIO.read(getClass().getResource(frontFile1));
150
+                final BufferedImage front2 = ImageIO.read(getClass().getResource(frontFile2));
151
+                final BufferedImage front3 = ImageIO.read(getClass().getResource(frontFile3));
152
+                final BufferedImage back1 = ImageIO.read(getClass().getResource(backFile));
153
+                final int width = front1.getWidth();
154
+                final int height = front1.getHeight();
155
+                
156
+                final int offsetX = (getWidth() - width * 4 - 30) / 2;
157
+                final int offsetY = (getHeight() - height) / 2;
158
+
159
+                ((Graphics2D) g).drawImage(front1, offsetX, offsetY, offsetX + width, 
160
+                        offsetY + height, 0, 0, width, height, this);
161
+                ((Graphics2D) g).drawImage(front2, offsetX + width + 10, offsetY, 
162
+                        offsetX + 2 * width + 10, offsetY + height, 0, 0, width, height, this);
163
+                ((Graphics2D) g).drawImage(front3, offsetX + 2 * (width + 10), offsetY, 
164
+                        offsetX + 3 * width + 20, offsetY + height, 0, 0, width, height, this);
165
+                ((Graphics2D) g).drawImage(back1, offsetX + 3 * (width + 10), offsetY, 
166
+                        offsetX + 4 * width + 30, offsetY + height, 0, 0, back1.getWidth(),
167
+                        back1.getHeight(), this);
168
+            } catch (IOException ex) {
169
+                ex.printStackTrace();
170
+            }
171
+
172
+        }
173
+        
174
+    }
175
+
176
+}

+ 15
- 9
src/com/md87/cardgame/config/ConfigScreen.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).
@@ -39,6 +39,7 @@ public class ConfigScreen extends JDialog {
39 39
     private final PlayerPanel playerPanel = new PlayerPanel();
40 40
     private final GamePanel gamePanel = new GamePanel(this);
41 41
     private final BettingPanel bettingPanel = new BettingPanel();
42
+    private final AppearancePanel stylePanel = new AppearancePanel();
42 43
     private final JPanel savePanel = new JPanel();
43 44
     
44 45
     private GameInfo game;
@@ -50,12 +51,14 @@ public class ConfigScreen extends JDialog {
50 51
         Image playerIcon = null;
51 52
         Image moneyIcon = null;
52 53
         Image saveIcon = null;
54
+        Image styleIcon = null;
53 55
         
54 56
         try {
55
-            gameIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icon.png"));
56
-            playerIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/user.png"));
57
-            moneyIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/money.png"));
58
-            saveIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/save.png"));
57
+            gameIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icons/icon.png"));
58
+            playerIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icons/user.png"));
59
+            moneyIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icons/money.png"));
60
+            saveIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icons/save.png"));
61
+            styleIcon = ImageIO.read(getClass().getResource("/com/md87/cardgame/res/icons/style.png"));
59 62
         } catch (IOException ex) {
60 63
             System.err.println("Unable to load icons");
61 64
         }   
@@ -64,11 +67,12 @@ public class ConfigScreen extends JDialog {
64 67
         
65 68
         setTitle("JaPoker: Game configuration");
66 69
         
67
-        tabbedPane.addTab("Game type", new ImageIcon(gameIcon), gamePanel);
70
+        tabbedPane.addTab("Game", new ImageIcon(gameIcon), gamePanel);
68 71
         tabbedPane.addTab("Players", new ImageIcon(playerIcon), playerPanel);
69 72
         tabbedPane.addTab("Betting", new ImageIcon(moneyIcon), bettingPanel);
73
+        tabbedPane.addTab("Appearance", new ImageIcon(styleIcon), stylePanel);
70 74
         tabbedPane.addTab("Save/Load", new ImageIcon(saveIcon), savePanel);
71
-        
75
+        tabbedPane.setEnabledAt(4, false);
72 76
         tabbedPane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
73 77
         
74 78
         setLayout(new BorderLayout());
@@ -89,7 +93,7 @@ public class ConfigScreen extends JDialog {
89 93
         
90 94
         startButton.addActionListener(new ActionListener() {
91 95
             @Override
92
-            public void actionPerformed(ActionEvent e) {
96
+            public void actionPerformed(final ActionEvent e) {
93 97
                 startGame();
94 98
             }
95 99
         });
@@ -115,7 +119,9 @@ public class ConfigScreen extends JDialog {
115 119
         final Game myGame = game.getGame(playerPanel.getNumPlayers(), 
116 120
                 bettingPanel.getBigBlind(), bettingPanel.getAnte(), 
117 121
                 bettingPanel.getRaises());
118
-        final GameWindow window = new GameWindow(myGame);
122
+        final GameWindow window = new GameWindow(myGame,
123
+                stylePanel.getFrontName(), stylePanel.getBackName(),
124
+                stylePanel.getColour());
119 125
         
120 126
         for (Player player : playerPanel.getPlayers(myGame, window)) {
121 127
             myGame.addPlayer(player);

+ 1
- 1
src/com/md87/cardgame/config/PlayerPanel.java View File

@@ -66,7 +66,7 @@ public class PlayerPanel extends JPanel {
66 66
             sp.setPreferredSize(new Dimension(100, 20));
67 67
             
68 68
             final JComboBox co = new JComboBox(ControllerInfo.getControllers());
69
-            co.setPreferredSize(new Dimension(160, 20));
69
+            co.setPreferredSize(new Dimension(200, 20));
70 70
             
71 71
             if (i > 0) {
72 72
                 co.setSelectedIndex(3);

+ 27
- 0
src/com/md87/cardgame/config/cards/CardStyle.java View File

@@ -0,0 +1,27 @@
1
+/*
2
+ * Copyright (c) Chris 'MD87' Smith, 2007-2008. All rights reserved.
3
+ *
4
+ * This code may not be redistributed without prior permission from the
5
+ * aforementioned copyright holder(s).
6
+ */
7
+
8
+package com.md87.cardgame.config.cards;
9
+
10
+/**
11
+ *
12
+ * @author chris
13
+ */
14
+public interface CardStyle {
15
+
16
+    /** {@inheritDoc} */
17
+    @Override
18
+    String toString();
19
+    
20
+    /**
21
+     * Retrieves the folder name for the card front.
22
+     * 
23
+     * @return The card front's folder name
24
+     */
25
+    String getFolderName();
26
+    
27
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/ClassicBack1.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class ClassicBack1 implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "Classic blue";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "classic1";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/ClassicBack2.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class ClassicBack2 implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "Classic red";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "classic2";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/ClassicFront1.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class ClassicFront1 implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "Classic small";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "classic";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/ClassicFront2.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class ClassicFront2 implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "Classic large";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "classic2";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaBlueCardsBack.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaBlueCardsBack implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart blue cards";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocabluecards";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaBlueHatchBack.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaBlueHatchBack implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart blue hatch";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocabluehatch";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaBlueSuits1Back.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaBlueSuits1Back implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart blue suits 1";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocabluesuits1";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaBlueSuits2Back.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaBlueSuits2Back implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart blue suits 2";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocabluesuits2";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaRedCardsBack.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaRedCardsBack implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart red cards";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocaredcards";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaRedHatchBack.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaRedHatchBack implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart red hatch";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocaredhatch";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaRedSuits1Back.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaRedSuits1Back implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart red suits 1";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocaredsuits1";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaRedSuits2Back.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaRedSuits2Back implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart red suits 2";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocaredsuits2";
21
+    }
22
+
23
+}

+ 23
- 0
src/com/md87/cardgame/config/cards/OcaWhiteFront.java View File

@@ -0,0 +1,23 @@
1
+/*
2
+ * To change this template, choose Tools | Templates
3
+ * and open the template in the editor.
4
+ */
5
+
6
+package com.md87.cardgame.config.cards;
7
+
8
+/**
9
+ *
10
+ * @author chris
11
+ */
12
+public class OcaWhiteFront implements CardStyle {
13
+
14
+    @Override
15
+    public String toString() {
16
+        return "OpenClipart White";
17
+    }
18
+
19
+    public String getFolderName() {
20
+        return "ocawhite";
21
+    }
22
+
23
+}

+ 24
- 6
src/com/md87/cardgame/controllers/RandomPlayer.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).
@@ -15,15 +15,21 @@ import com.md87.cardgame.interfaces.Game;
15 15
 import com.md87.cardgame.interfaces.PlayerController;
16 16
 
17 17
 /**
18
- *
18
+ * A computer-controlled player that choses what to do randomly.
19
+ * 
19 20
  * @author Chris
20 21
  */
21 22
 public class RandomPlayer implements PlayerController {
22 23
     
24
+    /** The player that we're controlling. */
23 25
     protected Player player;
26
+    
27
+    /** The game that we're playing. */
24 28
     protected Game game;
25 29
 
26
-    public CallRaiseFold doCallRaiseFold(int callAmount, boolean canRaise) {
30
+    /** {@inheritDoc} */
31
+    @Override
32
+    public CallRaiseFold doCallRaiseFold(final int callAmount, final boolean canRaise) {
27 33
         if (Math.random() < 0.3) {
28 34
             if (player.getCash() - callAmount < game.getBigBlind() || !canRaise) {
29 35
                 return CallRaiseFold.FOLD;
@@ -35,6 +41,8 @@ public class RandomPlayer implements PlayerController {
35 41
         }
36 42
     }
37 43
 
44
+    /** {@inheritDoc} */
45
+    @Override
38 46
     public OpenCheck doOpenCheck() {
39 47
         if (Math.random() < 0.5 || player.getCash() < game.getBigBlind()) {
40 48
             return OpenCheck.CHECK;
@@ -43,28 +51,38 @@ public class RandomPlayer implements PlayerController {
43 51
         }
44 52
     }
45 53
 
54
+    /** {@inheritDoc} */
55
+    @Override
46 56
     public boolean shouldShowCards() {
47 57
         return false;
48 58
     }
49 59
 
50
-    public void setPlayer(Player player) {
60
+    /** {@inheritDoc} */
61
+    @Override
62
+    public void setPlayer(final Player player) {
51 63
         this.player = player;
52 64
     }
53 65
     
54
-    public void setGame(Game game) {
66
+    /** {@inheritDoc} */
67
+    @Override
68
+    public void setGame(final Game game) {
55 69
         this.game = game;
56 70
     }
57 71
 
58
-    public int getRaise(int minimum) {
72
+    /** {@inheritDoc} */
73
+    @Override    
74
+    public int getRaise(final int minimum) {
59 75
         return minimum;
60 76
     }
61 77
     
62 78
     /** {@inheritDoc} */
79
+    @Override
63 80
     public boolean isLocalHuman() {
64 81
         return false;
65 82
     }
66 83
 
67 84
     /** {@inheritDoc} */
85
+    @Override
68 86
     public Deck discardCards(final int minimum, final int maximum) {
69 87
         return new Deck(player.getCards().subList(0, minimum));
70 88
     }

+ 1
- 1
src/com/md87/cardgame/interfaces/PlayerController.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).

BIN
src/com/md87/cardgame/res/backs/classic1.png View File


BIN
src/com/md87/cardgame/res/backs/classic2.png View File


BIN
src/com/md87/cardgame/res/backs/ocabluecards.png View File


BIN
src/com/md87/cardgame/res/backs/ocabluehatch.png View File


BIN
src/com/md87/cardgame/res/backs/ocabluesuits1.png View File


BIN
src/com/md87/cardgame/res/backs/ocabluesuits2.png View File


BIN
src/com/md87/cardgame/res/backs/ocaredcards.png View File


BIN
src/com/md87/cardgame/res/backs/ocaredhatch.png View File


BIN
src/com/md87/cardgame/res/backs/ocaredsuits1.png View File


BIN
src/com/md87/cardgame/res/backs/ocaredsuits2.png View File


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


+ 234
- 0
src/com/md87/cardgame/res/fronts/classic2/sjack.png
File diff suppressed because it is too large
View File


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


+ 234
- 0
src/com/md87/cardgame/res/fronts/classic2/snine.png
File diff suppressed because it is too large
View File


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


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


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


+ 234
- 0
src/com/md87/cardgame/res/fronts/classic2/sten.png
File diff suppressed because it is too large
View File


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


+ 0
- 0
src/com/md87/cardgame/res/fronts/ocawhite/dfour.png View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save