From d744d5f04234da7c379055fe78f8bcffe8605698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Sun, 7 Apr 2024 23:52:58 +0500 Subject: [PATCH] Add "cross" as one of the "games". --- games/cross/__init__.py | 17 +++++++++++++++++ games/cross/cross.json | 1 + 2 files changed, 18 insertions(+) create mode 100644 games/cross/__init__.py create mode 100644 games/cross/cross.json 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