working on bowling demo
git-svn-id: svn://anubis/anaglym/trunk@213 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
5ec32efdd0
commit
53c51f9382
@ -34,7 +34,7 @@ function setupStars()
|
||||
stars = ag.startList()
|
||||
local dist = 500
|
||||
for i = 1, 500 do
|
||||
local rx = math.random() * math.pi * 2
|
||||
local rx = math.random() * math.pi
|
||||
local ry = (math.random() - 0.5) * math.pi * 0.8
|
||||
local x = dist * math.cos(ry) * math.cos(rx)
|
||||
local y = dist * math.cos(ry) * math.sin(rx)
|
||||
@ -147,11 +147,19 @@ function drawFrameScore(width, height, frame, fs)
|
||||
local_width = 80
|
||||
end
|
||||
local base_x = size / 2 + size * (frame - 1)
|
||||
local base_y = height - size / 2 - size
|
||||
ag.drawRect(1, 0.6, 0, local_width, size, base_x + local_width / 2, base_y + size / 2)
|
||||
ag.drawRect(1, 0.6, 0, ball_size, ball_size, base_x + local_width - ball_size / 2, base_y + size - ball_size / 2)
|
||||
local base_y = height - 2 * size
|
||||
local str = string.format("%d", frame)
|
||||
local w, h = ag.getTextSize(str, 16)
|
||||
ag.drawText(str, 1, 0.6, 0, 16,
|
||||
base_x + local_width / 2 - w / 2, base_y + size + 5)
|
||||
ag.drawRect(1, 0.6, 0, local_width, size,
|
||||
base_x + local_width / 2, base_y + size / 2)
|
||||
ag.drawRect(1, 0.6, 0, ball_size, ball_size,
|
||||
base_x + local_width - ball_size / 2, base_y + size - ball_size / 2)
|
||||
if (frame == 10) then
|
||||
ag.drawRect(1, 0.6, 0, ball_size, ball_size, base_x + local_width - ball_size * 1.5, base_y + size - ball_size / 2)
|
||||
ag.drawRect(1, 0.6, 0, ball_size, ball_size,
|
||||
base_x + local_width - ball_size * 1.5,
|
||||
base_y + size - ball_size / 2)
|
||||
end
|
||||
|
||||
local balls = 2
|
||||
@ -197,6 +205,15 @@ function update_overlay_event(width, height)
|
||||
local score_str = string.format("Score: %d", score[10]["tot"])
|
||||
w, h = ag.getTextSize(score_str, 56)
|
||||
ag.drawText(score_str, 1, 1, 0, 56, width / 2 - w / 2, height * 0.7 - 20 - h / 2)
|
||||
else
|
||||
local str = string.format("%d", current_frame)
|
||||
local w, h = ag.getTextSize(str, 72)
|
||||
ag.drawText(str, 1, 0.6, 0, 72, 20, 20)
|
||||
ag.drawText("Frame:", 1, 0.6, 0, 24, 20, 40 + h)
|
||||
str = string.format("%d", current_ball)
|
||||
w, h = ag.getTextSize(str, 72)
|
||||
ag.drawText(str, 1, 0.6, 0, 72, 200, 20)
|
||||
ag.drawText("Ball:", 1, 0.6, 0, 24, 200, 40 + h)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user