aboutsummaryrefslogtreecommitdiff
path: root/src/gameplay/Timer.java
blob: 96a6c30cff4be07815e5ce9f1a6c4755b0697998 (plain) (blame)
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
/*Name:	Guitar Hero Project
 *Description: Contains the method used to determine how long the user has been playing, 
 *             used to determine when to send notes
 */
package gameplay;


public class Timer
{
    private long timeStart = System.currentTimeMillis();
    private double bpm;

    public Timer(double newBpm) {
        bpm = newBpm;
    }

    public Timer() {
        bpm = 60000;
    }

    public double time() {
        return ((double)(System.currentTimeMillis()-timeStart)-2000)*(bpm/60000.0);
    }

    public String toString() {      
        return ""+((Math.round(10*(((double)(System.currentTimeMillis()-timeStart))*(bpm/60000.0))))/10.0);
    }
}