From 013e24e2853f88717b51e697e1a8a1c725cfae71 Mon Sep 17 00:00:00 2001 From: Paul Liverman Date: Wed, 6 May 2015 17:29:33 -0700 Subject: [PATCH] more stuff wipped --- ideas.txt | 12 ++++++++++++ src/main.lua | 5 ++++- src/wheel.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 ideas.txt create mode 100644 src/wheel.lua diff --git a/ideas.txt b/ideas.txt new file mode 100644 index 0000000..6faff34 --- /dev/null +++ b/ideas.txt @@ -0,0 +1,12 @@ +1-4 on first dial, main dial +5-8 on second dial + +1 Time orange +2 Ammo red +3 Fuel yellow +4 Supplies blue ? + +5 Water teal ? +6 Food green +7 Metal silver +8 Ore brown diff --git a/src/main.lua b/src/main.lua index 26c85bf..e199e5d 100644 --- a/src/main.lua +++ b/src/main.lua @@ -73,6 +73,8 @@ local function drawClock(x, y, r) lg.setColor(255, 255, 255) end +local drawWheel = require "wheel"; + function love.draw() lg.translate(hx, hy) @@ -86,7 +88,8 @@ function love.draw() lg.setColor(255, 255, 255) end - drawClock(-355, -145, 120) + --drawClock(-355, -145, 120) + drawWheel(-355, -145, 120, timer) end function love.keypressed(key, unicode) diff --git a/src/wheel.lua b/src/wheel.lua new file mode 100644 index 0000000..e4db41f --- /dev/null +++ b/src/wheel.lua @@ -0,0 +1,42 @@ +local verticalOffset = math.pi/2 +local maxTime = 60 + +local segments = 60 +local segmentRadius = math.pi*2 / segments + +local dividerRadius = segmentRadius / 2 + +local lg = love.graphics + +local function drawWheel(x, y, r, time) + time = math.floor(33 - time) + if time == 0 then time = 33 end + + lg.setColor(255, 102, 0) + for i=1,time do + lg.arc("fill", x, y, r, (i-1)*segmentRadius - verticalOffset, i*segmentRadius - dividerRadius - verticalOffset) + end + lg.setColor(0, 0, 0) + lg.circle("fill", x, y, r/1.15) + + -- this looks cool and all, but it is the same function as the outer ring + -- instead, use this internal space for displaying things like fuel and water and supplies + --[[ + segments = 12 + segmentRadius = math.pi*2 / segments + dividerRadius = segmentRadius / segments * 2 + time = math.floor(time/maxTime * segments) --33 -> 12 percentage = time/maxTime..multiply this by 12 + + lg.setColor(255, 102, 0) + for i=1,time do + lg.arc("fill", x, y, r/1.5, (i-1)*segmentRadius - verticalOffset, i*segmentRadius - dividerRadius - verticalOffset) + end + lg.setColor(0, 0, 0) + lg.circle("fill", x, y, r/2) + --]] + + --tmp, really each color-dependent section should do this itself! + lg.setColor(255, 255, 255) +end + +return drawWheel