-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathParticleSystem_v5.java
More file actions
51 lines (39 loc) · 1.16 KB
/
ParticleSystem_v5.java
File metadata and controls
51 lines (39 loc) · 1.16 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
44
45
46
47
48
49
50
51
// sdurant12
// 11/14/2012
package particlesystem_v5;
import java.awt.Canvas;
import javax.swing.*;
public class ParticleSystem_v5 extends Canvas {
public static final int WIDTH = 1920;
public static final int HEIGHT = 1200;
public static final int TICK = 33;
public static void main(String[] args) {
JFrame frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(WIDTH, HEIGHT);
//frame.setUndecorated(true);
frame.setResizable(false);
frame.setFocusable(true);
final RenderClass_v5 ren = new RenderClass_v5(WIDTH, HEIGHT);
frame.add(ren);
frame.setVisible(true);
Thread runThread = new Thread(new Runnable() {
public void run() {
if (true) {
while (true) {
long time = System.currentTimeMillis();
ren.tick();
ren.repaint();
long endtime = System.currentTimeMillis();
try {
Thread.sleep(TICK - (endtime - time));
} catch (Exception e) {
System.out.println("Exception e at Thread.sleep");
}
}
}
}
});
runThread.start();
}
}