Difference between revisions of "Monocle"
(Created page with "{{#set:Name=Monocle}} {{#set:LOVE Version=0.9.0}} {{#set:Description= Debugging & Expression watching for Love2D}} '''Monocle'''is a simple, but very helpful debugging library f...") |
|||
Line 1: | Line 1: | ||
{{#set:Name=Monocle}} | {{#set:Name=Monocle}} | ||
− | {{#set:LOVE Version=0.9. | + | {{#set:LOVE Version=0.9.1}} |
{{#set:Description= Debugging & Expression watching for Love2D}} | {{#set:Description= Debugging & Expression watching for Love2D}} | ||
Latest revision as of 03:48, 25 June 2014
Monocleis a simple, but very helpful debugging library for Love2D.
Monocle can watch variables and expressions and keep them pinned to the top left of the screen.
If a problem occurs, the game will issue an error, but the watched expressions stay on the screen.
Best of all, the game will watch files and automatically reload the game when those files have been changed.
Basic implementation:
require 'monocle/monocle'
Monocle.new({})
-- The most basic way to watch any expression or variable:
Monocle.watch("FPS", function() return math.floor(1/love.timer.getDelta()) end)
function love.update(dt)
Monocle.update()
end
function love.draw()
Monocle.draw()
end
function love.textinput(t)
Monocle.textinput(t)
end
function love.keypressed(text)
Monocle.keypressed(text)
end
Monocle can also be started with options in mind that are tailored to your needs!
Monocle.new({ -- ALL of these parameters are optional!
isActive=true, -- Whether the debugger is initially active
customPrinter=false, -- Whether Monocle prints status messages to the output
printColor = {51,51,51},-- Color to print with
debugToggle='`', -- The keyboard button for toggling Monocle
filesToWatch= -- Files that, when edited, cause the game to reload automatically
{
'main.lua'
}
})
You can find it at [1].