From c5d32f46e205e66cdb8297a23a32be5d029d2ac8 Mon Sep 17 00:00:00 2001 From: devfirefly Date: Sat, 7 Nov 2015 11:24:53 +0000 Subject: [PATCH] initial --- main.lua | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 main.lua diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..575e1e4 --- /dev/null +++ b/main.lua @@ -0,0 +1,60 @@ +Profiler = require("piefiller") +ProfOn = true +drawRect = true +local Prof = Profiler:new() +function iterateSmall() + for i=1,1000 do + end +end +function iterateLarge() + for i=1,100000 do + + end +end +function drawRectangles() + for i=1,100 do + love.graphics.setColor(255,0,0) + love.graphics.rectangle("line",i,i,i,i) + love.graphics.setColor(255,255,255) + end +end +function love.load() +end +function love.draw() + if drawRect then + drawRectangles() + Prof:dettach() + end + if ProfOn then + Prof:draw({50}) + end +end +function hay() +end +function love.update(dt) + Prof:attach() + iterateSmall() + iterateLarge() + if drawRect then + Prof:dettach(true) + else + Prof:dettach() + end + if hey then + hay() + hay() + hay() + hay() + end +end +function love.keypressed(key) + if key == "esc" then + ProfOn = not ProfOn + elseif key == ";" then + drawRect = not drawRect + end + Prof:keypressed(key) +end +function love.mousepressed(...) + Prof:mousepressed(...) +end