Browse Source

Set Layout Geber- WasteStack

feature_solitaer_setup_GamePanel
Alexander Hartung 3 years ago
parent
commit
8be8a7096b
  1. 37
      src/main/java/solitaer/SolitaerGamePanel.java

37
src/main/java/solitaer/SolitaerGamePanel.java

@ -9,7 +9,9 @@ public class SolitaerGamePanel extends JPanel {
private static final long serialVersionUID = 1L;
private final int OFFSET_STACKS = 5;
private final int OFFSET_STACKS_X = 5;
private final int OFFSET_STACKS_Y = 10;
public final int IMAGE_WIDTH = 72;
public final int IMAGE_HIGHT = 96;
@ -20,6 +22,9 @@ public class SolitaerGamePanel extends JPanel {
private StartStack[] start = new StartStack[7] ;
private AblageStack[] ablage = new AblageStack[4];
private WasteStack w;// = new WasteStack(85, 10);
private GeberStack g;// = new GeberStack(10, 10, w);
@ -34,7 +39,7 @@ public class SolitaerGamePanel extends JPanel {
for(int i = 0; i<7; i++) {
int x = (((IMAGE_WIDTH+OFFSET_STACKS)*i)+OFFSET_STACKS);
int x = (((IMAGE_WIDTH+OFFSET_STACKS_X)*i)+OFFSET_STACKS_X);
System.out.println(x);
start[i] = new StartStack(x, 125);
this.add(start[i]);
@ -43,19 +48,19 @@ public class SolitaerGamePanel extends JPanel {
for(int i = 0; i<4; i++) {
int x = (((IMAGE_WIDTH+OFFSET_STACKS)*(3+i))+OFFSET_STACKS);
int x = (((IMAGE_WIDTH+OFFSET_STACKS_X)*(3+i))+OFFSET_STACKS_X);
switch (i) {
case 0:
ablage[i] = new AblageStack(x, 10, Symbol.Herz);
ablage[i] = new AblageStack(x, OFFSET_STACKS_Y, Symbol.Herz);
break;
case 1:
ablage[i] = new AblageStack(x, 10, Symbol.Kreuz);
ablage[i] = new AblageStack(x, OFFSET_STACKS_Y, Symbol.Kreuz);
break;
case 2:
ablage[i] = new AblageStack(x, 10, Symbol.Karo);
ablage[i] = new AblageStack(x, OFFSET_STACKS_Y, Symbol.Karo);
break;
case 3:
ablage[i] = new AblageStack(x, 10, Symbol.Pik);
ablage[i] = new AblageStack(x, OFFSET_STACKS_Y, Symbol.Pik);
break;
default:
@ -69,22 +74,8 @@ public class SolitaerGamePanel extends JPanel {
this.add(save);
WasteStack w = new WasteStack(85, 10);
GeberStack g = new GeberStack(10, 10, w);
deck.getDeck().get(34).setFaceUp(true);
w.addCard(deck.getDeck().get(34));
deck.getDeck().get(35).setFaceUp(true);
w.addCard(deck.getDeck().get(35));
deck.getDeck().get(36).setFaceUp(true);
w.addCard(deck.getDeck().get(36));
deck.getDeck().get(37).setFaceUp(true);
w.addCard(deck.getDeck().get(37));
g.addCard(deck.getDeck().get(38));
w = new WasteStack((IMAGE_WIDTH+(OFFSET_STACKS_X)*2), OFFSET_STACKS_Y);
g = new GeberStack(OFFSET_STACKS_X, OFFSET_STACKS_Y, w);
this.add(w);
this.add(g);

Loading…
Cancel
Save