pixelpte.py

Created by squarepoint

Created on November 10, 2023

615 Bytes

A nice 4x4 pixel based text engine, if you’re tired of the default text. It doesn’t even take up that much space :D Be sure to put only lowercase letters tho.

THANKS TO ANTARCTUS FOR CONVERTING THIS TO HEX, DIVIDING THE SPEED AND SIZE BY 2 :D

The font is the same one as in my game pumpkin peril (https://scratch.mit.edu/projects/435114033/)(go play it) i forgot where i stole it from

Oh also please credit me if you use it


from kandinsky import fill_rect as rct

D=["fbff","f676","f3cf","fecf","efdd","fc3f","ff3e","6ecf","fbdf","fcff","bfbf","fbd7","e33e","7bb7","f37f","337f","fb3f","bbfb","f66f","fdcc","b77b","f333","9dff","ddbb","6bb6","37b7","cede","b7b7","fe3f","66ff","fbbb","7bbb","ffd9","b66b","26bb","f7cf"]

def ptxt(t,x,y,s,c):
  for i in range(len(t)):
    if not t[i]==" ":
      n=int(D[int((t[i]),36)],16)
      for j in range(16):
        if n%2:
          rct(x+(j%4)*s,y+(j//4)*s,s,s,c)
        n//=2
    x+=s*5

ptxt("abcdefghijklmnopqrst",10,100,3,(0,0,0))
ptxt("uvwxyz 0123456789",10,120,3,(0,0,0))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.