Log In  

Printo


Printo is a homebrew function I've made over the course of a few projects. It has four different outline options:

-nil = simple outline
-0 = no outline (best to be used for centering)
-1 = lazyline (inspired by lazy dev text outlines)
-2 = crazyline (creates an ultra-thicc outline)

It also has the ability to center text, including ascii characters, unlike most centering scripts. Simply type c into the x value when calling Printo.

I've fully intended for printo to be copy-pasted willy-nilly, feel free to use it in any project.

Code:

 printo(text,x,y,color,outline_color,outline_type)

 --like this:
 printo("printo",c,62,7,1,nil)

And then copy this code into your functions tab, or at the bottom of your draw tab.

--printo
function printo(tt,px,py,cr,oc,ty)
 tt=tostr(tt)
 tl=#tt

 for i=1,#tt do
  if ord(tt,i)>128 then
   tl+=1
  end
 end

 if px==c then
  px=64-tl*2
 end

 --type nill (outline)
 if ty==nil then
  for x=-1,1 do
      for y=-1,1 do
       print(tt,px+x,py+y,max(oc,0))
      end
     end

    --type zero (noline)
    elseif ty==0 then

    --type one (lazyline)
    elseif ty==1 then
     for x=-1,1 do
      for y=-1,2 do
       print(tt,px+x,py+y,max(oc,0))
      end
     end

    --type two (sharpline)
    elseif ty==2 then
     for i=-1,1 do
      print(tt,px,py+i,max(oc,0))
      print(tt,px+i,py,max(oc,0))
     end

    --type three (crazyline)
    elseif ty==3 then
     for x=-1,1 do
      for y=-1,1 do
       print(tt,px+x,py+y,max(oc,0))
      end
     end
     for i=-2,2 do
      print(tt,px,py+i,max(oc,0))
      print(tt,px+i,py,max(oc,0))
     end
    end
 print(tt,px,py,cr)
end

PS - If token count becomes a problem you can delete the outlines you don't use. With two outline options it's 210 tokens, with one it's 114 tokens. Most projects will only need one outline option, but this tool was made with everything in mind.

-Marina XOXO
[8x8]

P#120655 2022-11-14 04:05 ( Edited 2022-11-15 04:42)

Hi @marina_makes:

This is nice what you have done here. You may see that Pico-8 has 1-built-in outline function already - I did not see this in your selection, one I rather like when highlighting selection buttons.

That of BLOCK outline.

cls()
?"\f7\#1Block Outline"

It's interesting you chose this topic, Marina. It is one of great delight to many !

https://www.lexaloffle.com/bbs/?tid=45020

Gold star for you in covering outline methods not yet written !

P#120659 2022-11-14 04:32 ( Edited 2022-11-14 04:32)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-01-29 05:42:10 | 0.039s | Q:11