Skip to content

Commit ca64333

Browse files
Hub created (still ugly)
1 parent 8b94c6b commit ca64333

File tree

6 files changed

+68
-34
lines changed

6 files changed

+68
-34
lines changed

Diff for: .vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
},
99
"java.configuration.updateBuildConfiguration": "automatic",
1010
"java.debug.settings.onBuildFailureProceed": true,
11-
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
11+
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:disable"
1212
}

Diff for: docs/HubOutline.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Hub
2+
3+
## Variables
4+
1. cnavas
5+
2. buttons
6+
7+
## Methods
8+
9+
1. main()
10+
1. create canvas
11+
3. create buttons
12+
- werdill
13+
- set
14+
15+
2. mains from Set & Werdill

Diff for: src/App.java

-5
This file was deleted.

Diff for: src/Hub.java

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import java.io.IOException;
2+
3+
import SetGame.SetGameMain;
4+
import Werdill.WerdillGame;
5+
import edu.macalester.graphics.CanvasWindow;
6+
import edu.macalester.graphics.ui.Button;
7+
8+
public class Hub {
9+
private final CanvasWindow canvas;
10+
11+
// private WerdillGame werdill;
12+
// private SetGameMain set;
13+
14+
private Button werdillButton;
15+
private Button setButton;
16+
17+
public Hub() throws IOException {
18+
canvas = new CanvasWindow(null, 100, 250);
19+
20+
werdillButton = new Button("Werdill");
21+
setButton = new Button("Set");
22+
23+
werdillButton.onClick(() -> {
24+
try {
25+
new WerdillGame();
26+
} catch (IOException e) {}
27+
});
28+
setButton.onClick(() -> {
29+
new SetGameMain();
30+
});
31+
32+
setButton.setPosition(0, 40);
33+
34+
canvas.add(setButton);
35+
canvas.add(werdillButton);
36+
}
37+
38+
// private void startWerdill() throws IOException {
39+
// werdill = new WerdillGame();
40+
// }
41+
42+
// private void startSet() throws IOException {
43+
// set = new SetGameMain();
44+
// }
45+
46+
public static void main(String[] args) throws Exception {
47+
new Hub();
48+
}
49+
}

Diff for: src/SetGame/SetGameMain.java

+2-27
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,11 @@ public class SetGameMain {
2020
public final CanvasWindow canvas;
2121

2222
// Instance Methods
23-
24-
// TEST METHOD
25-
26-
void visualCardTest() {
27-
Random rand = new Random();
28-
canvas.onClick((event) -> {
29-
canvas.removeAll();
30-
31-
Card card = new Card(rand.nextInt(3), rand.nextInt(3), rand.nextInt(3), rand.nextInt(3));
32-
canvas.add(card);
33-
34-
card.setPosition(Card.CARD_WIDTH, Card.CARD_HEIGHT);
35-
36-
GraphicsObject elementAt = canvas.getElementAt(event.getPosition());
37-
System.out.println(elementAt.getClass());
38-
if (elementAt != null && elementAt.getClass() == Rectangle.class) {
39-
((Rectangle) elementAt).setStrokeColor(Color.RED);
40-
((Rectangle) elementAt).setStrokeWidth(Card.SHAPE_AND_CARD_STROKE_WIDTH + 1);
41-
}
42-
43-
canvas.draw();
44-
});
45-
}
46-
47-
// END TEST METHOD
4823

4924
public SetGameMain() {
5025
canvas = new CanvasWindow("Set", 1200, 800);
26+
27+
startGame();
5128
}
5229

5330
public void createDeck() {
@@ -71,7 +48,5 @@ public void startGame(){
7148

7249
public static void main(String[] args) {
7350
SetGameMain game = new SetGameMain();
74-
// game.visualCardTest();
75-
game.startGame();
7651
}
7752
}

Diff for: src/Werdill/WerdillGame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class WerdillGame {
1414

1515
private final CanvasWindow canvas;
1616

17-
WerdillGame() throws IOException {
17+
public WerdillGame() throws IOException {
1818

1919
checker = new Checker();
2020

0 commit comments

Comments
 (0)