def portrait(imagepath): debug(3, "Writing portrait image at '"+imagepath+"'") if not os.path.exists(imagepath): print("ERROR: file not found: "+imagepath) image=asciify.runner(imagepath) writeraw("[-]") glob.bitcounter=0 writeraw(">") storechar(chr(27)) writeraw(">") storechar('[') writeraw(">") storechar('1') writeraw(">") storechar('C') writeraw("<<<<") printtext(chr(27)+"[f") for x in range(0,len(image)): if (image[x]=='@'): writeraw(">.>.>.>.<<<<") else: printchar(image[x]) if (x==138): printtext(chr(27)+"E") writeraw(">[-]>[-]>[-]>[-]<<<<") flushcode()
def image(image): debug(3, "Writing image at '" + image + "'") if not os.path.exists(image): print("ERROR: file not found: " + image) printtext(chr(27) + "[f") printtext(asciify.runner(image)) skipline(6) flushcode()
def preimage(path): debug(3, "Writing prerendered image at '" + path + "'") if not os.path.exists(path): print("ERROR: file not found: " + path) f = open(path, "r") printtext(chr(27) + "[f") printtext(f.read()) f.close flushcode()
def dialogue(speaking, text): debug(3, "Writing dialogue for " + speaking + ": '" + text + "'") cleardialogue() printtext(chr(27) + "[43;0H") if not (speaking == ""): printline('+' + ('-' * (len(speaking) + 2)) + '+') printline("| " + speaking + " |") else: skipline(2) printline('+' + ('-' * 148) + '+') printtext(linecorrect(text)) writeraw(">,[-]<")
def printframe(path): debug(3, "Writing prerendered image at '" + path + "'") if not os.path.exists(path): print("ERROR: file not found: " + path) f = open(path, "r") printtext(chr(27) + "[f") writeraw("[-]") for c in f.read(): if c == 'b': writeraw("<.>") writeraw("++++++[-]") #Idle elif c == 'w': writeraw(">[.>]<[<]") else: glob.bitcounter = 0 printchar(c) writeraw("[-]") f.close flushcode()
def clearline(): printtext(chr(27) + "[2K")
def cleardialogue(): for x in range(0, 6): printtext(chr(27) + "[4" + str(3 + x) + ";0H") clearline()
import init import glob from functions.printtext import printtext from functions.printframe import printframe from functions.storechar import storechar from functions.writeraw import writeraw from functions.flushcode import flushcode try: open('BadApple.bf', 'w').close() #wipe code except: # Previous file does not exist, continue True # Empty instruction to stop python from complaining print("Compiling to './BadApple.bf'...") printtext(chr(27) + "[?25l") # Hide cursor printtext(chr(27) + "[2J") # Clear screen printtext(chr(27) + "[1m") # Enable bold colours # Initialse frame drawing storechar(' ') writeraw(">>") storechar('\xE2') writeraw(">") storechar('\x96') writeraw(">") storechar('\x88') writeraw("[<]") # end for x in range(1, 6575): print("Frame " + str(x) + "...", end="")