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
8

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!

P#101562 2021-12-05 19:28 ( Edited 2021-12-05 19:51)

lo mejor que hice

P#102415 2021-12-11 16:38

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

P#102723 2021-12-14 06:24

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.

P#103845 2021-12-30 21:05 ( Edited 2021-12-31 02:04)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 06:47:59 | 0.015s | Q:18