ADD: JSON reader, and map config read from file

This commit is contained in:
2025-03-15 22:41:35 +01:00
parent 61de16af8d
commit 7a6410afb5
2 changed files with 19 additions and 7 deletions

12
json_object.py Normal file
View File

@@ -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]

View File

@@ -1,9 +1,9 @@
{ {
"map_middle_x": 650, "middle_x": 650,
"map_middle_y": 320, "middle_y": 320,
"map_scale": 0.6, "scale": 0.6,
"map_rotation": 270, "rotation": 270,
"map_image": "de_mirage.png", "image_path": "maps/de_mirage.png",
"map_image_width": 1024, "image_width": 1024,
"map_image_height": 1024 "image_height": 1024
} }