diff --git a/games/cross/__init__.py b/games/cross/__init__.py new file mode 100644 index 0000000..648de93 --- /dev/null +++ b/games/cross/__init__.py @@ -0,0 +1,17 @@ +import importlib.resources as impr +import sys +import json +import serialize +from engineevents import EngineEvent + +def init(aoEngineEvents): + curm = sys.modules[__name__] + files = impr.files(curm) + level = None + with files.joinpath("cross.json").open('r') as leveldir: + level = json.loads(leveldir.read(), object_hook=serialize.object_hook) + aoEngineEvents.append(EngineEvent( + 'level', + lambda _: level, + tsArguments=() + )) diff --git a/games/cross/cross.json b/games/cross/cross.json new file mode 100644 index 0000000..c4156e0 --- /dev/null +++ b/games/cross/cross.json @@ -0,0 +1 @@ +[{"__type__": "objSegment", "isFinite": false, "pointA": {"__type__": "complex", "real": 1.0, "imag": 0.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": 0.0}, "color": [255, 0, 0]}, {"__type__": "objSegment", "isFinite": false, "pointA": {"__type__": "complex", "real": 0.0, "imag": 1.0}, "pointB": {"__type__": "complex", "real": 0.0, "imag": 0.0}, "color": [0, 255, 0]}] \ No newline at end of file