From 7a6410afb55c627cbeffc9abe38cfc57d9668b40 Mon Sep 17 00:00:00 2001 From: ThisBirchWood Date: Sat, 15 Mar 2025 22:41:35 +0100 Subject: [PATCH] ADD: JSON reader, and map config read from file --- json_object.py | 12 ++++++++++++ maps/de_mirage.json | 14 +++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 json_object.py diff --git a/json_object.py b/json_object.py new file mode 100644 index 0000000..94b2862 --- /dev/null +++ b/json_object.py @@ -0,0 +1,12 @@ +import json + +class JSONObject: + def __init__(self, path): + self.path = path + + def read(self): + with open(self.path, "r") as f: + return json.load(f) + + def get(self, key): + return self.read()[key] \ No newline at end of file diff --git a/maps/de_mirage.json b/maps/de_mirage.json index 596ec5e..dc5f438 100644 --- a/maps/de_mirage.json +++ b/maps/de_mirage.json @@ -1,9 +1,9 @@ { - "map_middle_x": 650, - "map_middle_y": 320, - "map_scale": 0.6, - "map_rotation": 270, - "map_image": "de_mirage.png", - "map_image_width": 1024, - "map_image_height": 1024 + "middle_x": 650, + "middle_y": 320, + "scale": 0.6, + "rotation": 270, + "image_path": "maps/de_mirage.png", + "image_width": 1024, + "image_height": 1024 } \ No newline at end of file