ADD: JSON reader, and map config read from file
This commit is contained in:
12
json_object.py
Normal file
12
json_object.py
Normal 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]
|
||||||
@@ -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
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user