Added full-surface alpha and rotaiton and scaling support
[luagame.git] / demos / luashooter / scripts / scoreboard.lua
blob96e64e09ed044c5d3dad28ee31f4442c283fe8e8
1 --[[
2 File: scoreboard.lua
3 Author: Brett Lajzer
4 Date: 5.24.2006
6 About:
7 This contains facilities for drawing the scoreboard.
8 --]]
11 scoreboard = {}
12 scoreboard.score = 0
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
19 for i=1, #temp do
20 local digit = string.sub(temp, i, i)
22 if digit == "0" then
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)
42 end
44 end
46 end