From 8be8a7096b9d9b3a76492a6386488c49b95e4478 Mon Sep 17 00:00:00 2001 From: Alexander Hartung Date: Fri, 4 Feb 2022 16:19:21 +0100 Subject: [PATCH] Set Layout Geber- WasteStack --- src/main/java/solitaer/SolitaerGamePanel.java | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/main/java/solitaer/SolitaerGamePanel.java b/src/main/java/solitaer/SolitaerGamePanel.java index 7e867a7..84454cd 100644 --- a/src/main/java/solitaer/SolitaerGamePanel.java +++ b/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);