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 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()
# 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="") printframe("processedframes/" + str(x) + ".txt") flushcode() print("done") printtext(chr(27) + "[f") # Reset cursor printtext("Demo Written by OpenSauce\n") printtext("Thanks for watching!\n") printtext(chr(27) + "[?25h") # Show cursor flushcode() glob.f.close() print("done.")