diff --git a/main.lua b/main.lua index 524e155..1b84bf4 100644 --- a/main.lua +++ b/main.lua @@ -1,64 +1,3 @@ ---local MAX_SECONDS = 60 * 60 * 12 - ---local Hand = {} ---Hand.__index = Hand - ---function Hand:new(length, color, sec_per_turn, ticks_per_turn) --- local h = { --- length = (length or 10), --- color = (color or {1,1,1}), --- sec_per_turn = (sec_per_turn or 1), --- ticks_per_turn = ticks_per_turn --- } --- return setmetatable(h, self) ---end - ---function Hand:draw(sec_elapsed) --- local turns = sec_elapsed / self.sec_per_turn --- if self.ticks_per_turn then --- turns = math.floor(turns * self.ticks_per_turn) / self.ticks_per_turn --- end --- love.graphics.push("all") --- love.graphics.setColor(unpack(self.color)) --- love.graphics.rotate(2 * math.pi * turns) --- love.graphics.rectangle("fill", -10, 10, 20, -self.length) --- love.graphics.pop() ---end - ---local clock = {rawseconds = 0, speedup = 120} - ---function clock:advance(dt) --- self.rawseconds = self.rawseconds + dt * self.speedup --- if self.rawseconds >= MAX_SECONDS then --- self.rawseconds = self.rawseconds - MAX_SECONDS --- end ---end - ---function clock:getHour() --- local h = math.floor(self.rawseconds / 60 / 60 % 12) --- if h == 0 then --- h = 12 --- end --- return h ---end - ---function clock:getMinute() --- return math.floor(self.rawseconds / 60 % 60) ---end - ---function clock:getSecond() --- return math.floor(self.rawseconds % 60) ---end - ---function clock:fmt() --- return string.format("%2d:%02d:%02d", self:getHour(), self:getMinute(), self:getSecond()) ---end - ---local secondhand = Hand:new(300, {0.5,0.5,0}, 60, 60) ---local minutehand = Hand:new(240, {1,0,0}, 60*60) ---local hourhand = Hand:new(180, {0,0.5,0.5}, 60*60*12) - --- New stuff: local Clock = require"clock" local clockTransform = love.math.newTransform(love.graphics.getWidth()/2, love.graphics.getHeight()/2) local clock = Clock:new(nil, 400, clockTransform)