Selectable shader module

This commit is contained in:
Emily 2020-02-12 13:32:55 +01:00
parent c90938efbd
commit 8d67d68f26

14
main.py
View File

@ -1,16 +1,22 @@
# import shutil # shutil.get_terminal_size(fallback=(0, 0))
import os
import sys
import math
from importlib import import_module
from pixel import Screen
from shaders import eyeblower
WIDTH, HEIGHT = 100, 30 # Set to -1, -1 for dynamic resolution
STD_HANDLE = 1 # Would want this to be 0, but it can cause issues
if len(sys.argv) < 2: # Randomly select a shader
from glob import glob
from random import choice
module = import_module( choice( glob("shaders/*.py") ).rstrip(".py").replace("\\", ".") )
else:
module = import_module("shaders.%s" % sys.argv[1])
screen = Screen(WIDTH, HEIGHT, STD_HANDLE, [
eyeblower.main
module.main
])
screen.mainloop()