-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
BigCollection.java
69 lines (62 loc) · 1.8 KB
/
BigCollection.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package dlparty;
import org.ice1000.jimgui.JImGui;
import org.ice1000.jimgui.JImStr;
import org.ice1000.jimgui.util.JniLoader;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static dlparty.TestBed.sizeX;
import static dlparty.TestBed.sizeY;
public class BigCollection {
public static class Case {
private final JImStr str;
private final TestBed bed;
public Case(@NotNull TestBed bed) {
this.bed = bed;
this.str = new JImStr(bed.getClass().getSimpleName());
}
public void work(JImGui imGui) {
bed.testBed(imGui, str);
}
}
public static void main(String[] args) {
JniLoader.load();
try (JImGui imGui = new JImGui(1600, 1200, "FX")) {
List<Case> toys = Stream.of(new Curves(),
new Circles(),
new MatrixEffect(),
new Squares(),
new ThunderStorm(),
new TinyLoadingScreen(),
new Blobs(),
new RaceTrack(),
new ThreeDCube(),
new InterwebBlogosphere(),
// new Mosaic(),
new Plasma(),
new PossiblyAShrub(),
new DoomFire(),
new BouncingBalls(),
new DrivingGame(),
new TixyLand(),
new Guitar(),
new QuickSortVisualization()).map(Case::new).collect(Collectors.toList());
while (!imGui.windowShouldClose()) {
imGui.initNewFrame();
float x = 0, y = 0;
float windowSizeX = imGui.getPlatformWindowSizeX();
for (Case toy : toys) {
if (x + sizeX > windowSizeX) {
x = 0;
y += sizeY + 20;
}
imGui.setNextWindowPos(x, y);
toy.work(imGui);
x += sizeX + 10;
}
imGui.render();
}
}
}
}