-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetaBlobRender1.java
More file actions
43 lines (31 loc) · 1.33 KB
/
MetaBlobRender1.java
File metadata and controls
43 lines (31 loc) · 1.33 KB
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
package metablobrender1;
import javax.swing.JFrame;
public class MetaBlobRender1 {
public static final int WIDTH= 1200;
public static final int HEIGHT = 1200;
public static final int PARTICLECOUNT = 1;
public static final int TICK = 33;
public static void main(String[] args) {
JFrame frame = new JFrame("ParticleMaker");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(WIDTH, HEIGHT);
frame.setResizable(false);
frame.setFocusable(true);
final RenderClass1 ren = new RenderClass1(WIDTH, HEIGHT);
ren.spawnParticles(PARTICLECOUNT);
frame.add(ren);
frame.setVisible(true); // NEEDS TO BE AFTER ADDING ALL OBJECTS TO FRAME
final boolean stop = false; // final and yet needs to not be final to be useful
Thread runThread = new Thread(new Runnable(){
public void run(){
if(stop != true){
for(int i = 0; i < 1000000; i++){ //not infinite, stops after 1000000 repaint()'s
ren.repaint( );
try{Thread.sleep(TICK);}catch(Exception e){System.out.println("Exception e at Thread.sleep");}
}
}
}
});
runThread.start();
}
}