I don't think I need to give instructions; the buttons are really self-obvious. Start to start, stop to stop and reset to reset.
local running = false
local frameCount = 0
function drawmeter()
tpt.fillrect(4,335,25,10,255,255,255,255)
tpt.drawtext(6,337,"Start",0,0,0,255)
tpt.fillrect(29,335,22,10,255,255,255,255)
tpt.drawtext(31,337,"Stop",0,0,0,255)
tpt.fillrect(51,335,27,10,255,255,255,255)
tpt.drawtext(53,337,"Reset",0,0,0,255)
tpt.drawtext(80,337,frameCount .. " frames",155,155,155,255)
if running == true then
frameCount = frameCount + 1
end
end
function mouseTesting()
if tpt.mousex >= 4 and tpt.mousex <= 29 and tpt.mousey >= 335 and tpt.mousey <= 345 then
running = true
elseif tpt.mousex >= 29 and tpt.mousex <= 51 and tpt.mousey >= 335 and tpt.mousey <= 345 then
running = false
elseif tpt.mousex >= 51 and tpt.mousex <= 78 and tpt.mousey >= 335 and tpt.mousey <= 345 then
running = false
frameCount = 0
end
end
tpt.register_step(drawmeter)
tpt.register_mouseclick(mouseTesting)
Oh, and @mniip, I think I may have beaten you to this one.
While you're making scripts, I think one idea would be nice. Some sort of system to place "pixels" or sensors. These sensors would output the information such as temperature, element, pressure, etc to a text file. The frame time would be stored next to that information.
Nice script however!
Not quite useless, and simple isn't bad. Your scripts are too complicated, but no one cares...
Obviously to time things...
And my FPS meter works just as well as yours, looks as good and does everything yours does with much fewer lines...but it can't be as good, it's not as complex...
Well, it's graphics aren't quite as good (but almost), and it doesn't fade away, but it's just as useable.
And @lockheeedmartin: Challenge accepted. https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=17254 :) It can only place one sensor right now, but I'm getting there.
Arguably line count doesn't matter, but complexity, readability, maintainibility, and algorithmic complexity (the most important one) do.
Honestly, in this case since the end user is not seeing anything, both scripts are readable, and both run at acceptable speed, it comes down to how many features, and mniip has the clear advantage...
(I am referring to the clock scripts if anyone is wondering.)
Complexity (algorithmic or otherwise) doesn't really matter if you only consider the end result - more complex programs often run more slowly.