7 This contains facilities for drawing the scoreboard.
13 scoreboard
.image
, scoreboard
.w
, scoreboard
.h
= get_image("img/digits.png")
14 scoreboard
.w
= scoreboard
.w
/ 10
16 function scoreboard
.draw()
17 local temp
= "" .. scoreboard
.score
20 local digit
= string.sub(temp
, i
, i
)
23 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 0, 0, 1, 1,255)
24 elseif digit
== "1" then
25 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 1, 0, 1, 1,255)
26 elseif digit
== "2" then
27 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 2, 0, 1, 1,255)
28 elseif digit
== "3" then
29 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 3, 0, 1, 1,255)
30 elseif digit
== "4" then
31 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 4, 0, 1, 1,255)
32 elseif digit
== "5" then
33 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 5, 0, 1, 1,255)
34 elseif digit
== "6" then
35 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 6, 0, 1, 1,255)
36 elseif digit
== "7" then
37 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 7, 0, 1, 1,255)
38 elseif digit
== "8" then
39 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 8, 0, 1, 1,255)
40 elseif digit
== "9" then
41 display_frame(scoreboard
.image
, s_width
- (scoreboard
.w
* (#temp
- i
+ 1)), s_height
- scoreboard
.h
, 10, 9, 0, 1, 1,255)