Selectable shader module
This commit is contained in:
parent
c90938efbd
commit
8d67d68f26
14
main.py
14
main.py
|
@ -1,16 +1,22 @@
|
||||||
# import shutil # shutil.get_terminal_size(fallback=(0, 0))
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import math
|
import math
|
||||||
|
from importlib import import_module
|
||||||
|
|
||||||
from pixel import Screen
|
from pixel import Screen
|
||||||
|
|
||||||
from shaders import eyeblower
|
|
||||||
|
|
||||||
WIDTH, HEIGHT = 100, 30 # Set to -1, -1 for dynamic resolution
|
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
|
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, [
|
screen = Screen(WIDTH, HEIGHT, STD_HANDLE, [
|
||||||
eyeblower.main
|
module.main
|
||||||
])
|
])
|
||||||
|
|
||||||
screen.mainloop()
|
screen.mainloop()
|
Loading…
Reference in New Issue
Block a user