File: timer.d

package info (click to toggle)
projectl 1.001.dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,720 kB
  • ctags: 5
  • sloc: xml: 57; makefile: 32
file content (21 lines) | stat: -rw-r--r-- 750 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module util.timer;


private import std.math;
private import util.ascii;
//public float timerR = 1.0,timerG = 1.0 ,timerB = 1.0 ;

public void drawTimer(int timer,float x,float y ,float scale = 1.0){
	
	if(3600 * 100 <= timer)timer = 3600 * 100 -1;
	
	drawNumber((((timer / 60) / 60) / 10) % 10,x + 0 ,y ,scale);
	drawNumber(((timer / 60) / 60) % 10,x + 30*scale ,y ,scale);
	drawColon(x+50*scale ,y ,scale);
	drawNumber(((timer / 60) % 60) / 10,x + 70*scale ,y ,scale);
	drawNumber(((timer / 60) % 60) % 10,x + 100*scale ,y ,scale);
	drawColon(x+120*scale ,y ,scale);
	drawNumber(cast(int)ceil((timer % 60) / 0.6) / 10  ,x + 150*scale ,y ,scale);
	drawNumber(cast(int)ceil((timer % 60) / 0.6) % 10 ,x + 180*scale ,y ,scale);
}