Log In  


Heya! So, the new one-off character feature added in 0.2.4 inspired me to write a drawing tool that exported to compatible strings in the smallest size I could, as of now, the code itself is only 520 characters!
(Minor warning: clipboard saving seems to be incorrect through the html export, I recommend copying the code and running it locally)

Cart #bitdraw-3 | 2021-12-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

h=32s=stat::_::?"⁶t⁶wbitdraw!",34,8
a=8+(s(h)/8)-4b=(s(33)/8)-4j=ord?"\^.¹³⁷ᶠ゜?⁷⁸",s(h),s(33),0
?"⁶1⁶cd⁶!5f2d¹",7
rect(h,h,96,96)sspr(8,0,8,8,h,h,64,64)if(s(34)&1!=0)sset(a,b,7)
if(s(34)&2!=0)sset(a,b,0)
if btnp(❎)then
d=""for y=0,7do
k=0for x=8,15do
k|=(sget(x,y)&1)<<x-8end
d..=chr(k)end
o=""for i=1,#d do
c=sub(d,i,i)f=j(d,i+1)g=(f and f>=48and f<=57)and"00"or""v=c
if(c=="\"")v="\\\""
if(c=="\\")v="\\\\"
if(j(c)==0)v="\\"..g.."0"
if(j(c)==10)v="\\n"
if(j(c)==13)v="\\r"
o..=v
end
printh(o,"@clip")?"⁷ceg"
end
goto _

Controls:

  • Left Click: Draws inside the white rectangle
  • Right Click: Erases pixels in the rectangle
  • ❎: Copies your drawing to the clipboard alongside making a small noise to notify you

To then use your drawing, you need to use the \^. control code followed by your string:

print("\^.~▒しし▒し▥~") -- Prints a smiley block
?"\^.~▒しし▒し▥~" -- Short-hand version

Feel free to elaborate on this tool or minify the code even further!

9


lo mejor que hice


Awesome.
Thx for uploading this great tool, in addition to the "tweet" version.
Now I can load it easily with load #bitdraw


It doesn't seem to work on a Mac. The value I get in the clipboard is:

⁷\0\0\0\0\0\0\0

I am running this in PICO-8 locally

After further testing the issue seems to be when using "\^., if the last octet is nul, \0 it will not render properly. A bug report has been opened.



[Please log in to post a comment]