From d1eaff6d9655f50c56b7a06f515b78a1d092c850 Mon Sep 17 00:00:00 2001 From: Rose Liverman Date: Tue, 22 Sep 2026 15:48:33 -0600 Subject: [PATCH] fix critical timer typo and make timer work --- src/lib/timer.lua | 3 ++- src/main.lua | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/lib/timer.lua b/src/lib/timer.lua index 204f40c..e1d6075 100644 --- a/src/lib/timer.lua +++ b/src/lib/timer.lua @@ -1,7 +1,7 @@ local is_callable = function(callback) local _type = type(callback) if _type == "function" then return true end - of _type == "table" then + if _type == "table" then local metatable = getmetatable(callback) return (type(metatable) == "table") and (type(metatable.__call) == "function") end @@ -49,6 +49,7 @@ local new_timer = function(callback, update, ...) end return { + version = "v1.0.0-modified", after = function(deadline, callback, ...) local timer = new_timer(callback, update_after, ...) timer.deadline = deadline diff --git a/src/main.lua b/src/main.lua index 2fc5706..1989650 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1,15 +1,23 @@ -local utility = require "lib.utility" local progress_bar = require "lib.progress_bar" +local timer = require "lib.timer" +local utility = require "lib.utility" -- test progress_bar local window_width, window_height = love.graphics.getDimensions() local progress_bar_height = 30 -- TODO should not be hardcoded -local test = progress_bar(0, window_height - progress_bar_height, window_width, progress_bar_height) -test:set_text("This is a test text string of significant length. It exists to test printing over a progress bar.") -test:set_progress(math.random()) +local test_bar = progress_bar(0, window_height - progress_bar_height, window_width, progress_bar_height) +test_bar:set_text("This is a test text string of significant length. It exists to test printing over a progress bar.") +-- test:set_progress(math.random()) + +local test_timer = timer.every(1, function() end) -- TODO consider making timer not need a function; cause I don't here! + +love.update = function(dt) + timer.update(dt) + test_bar:set_progress(test_timer.run_time) +end love.draw = function() - test:draw() + test_bar:draw() end love.keypressed = function(key)