-
Notifications
You must be signed in to change notification settings - Fork 1
Description
This is a test of adding a new feature to L5. Feedback wanted.
PROBLEM.
This is an idea that grows out of a discussion with @JessicaGarson. Basically, currently the easiest method to get started working with L5 for users that don't use the command line is to drag their project folder on top of the Love2d icon. But unfortunately, that doesn't display print() output.
SOLUTION
I modified L5, adding basically an override of print so that it displays the output of print on screen. Inspired by the way that the Pico-8 print works, though that is different in that there is no text() function separate from print.
This is somewhat more complicated in that one could have print() inside draw(), and so I set it to display only the last N print statements and scroll down. For example, see my test code at the bottom.
By default, you won't see the print output on screen, so as to have feature parity with Processing-p5. But to turn it on, just add showPrint() to your setup or draw.
To try this out, you must download and run L5.lua from the print-in-window test branch!
Describe alternatives you've considered
I considered whether this should be on by default, which would be more beginner-friendly, but then requiring everyone to add something like showPrint(false) might be a step too much for those coming from other Processing-p5's, right?
Additional context
Example code:
require("L5")
function setup()
size(400, 400)
-- Set the program title
windowTitle("Basic sketch")
describe('Draws a yellow background')
showPrint()
end
function draw()
-- Fills the background with the color yellow
background(255, 215, 0)
print(frameCount)
endHere's what that looks like at the moment i screenshot (which was at frameCount number 672.
