diff --git a/SR-PY.py b/SR-PY.py index 7011558..622ce9b 100644 --- a/SR-PY.py +++ b/SR-PY.py @@ -6,9 +6,22 @@ mail: 3695888@qq.com import pyglet import libs import json +import sys +import os + def main(): - pass + main_path = "d:\\git\\SR" + os.chdir(path=main_path) + py_v_info = sys.version_info + py_v = str("%d.%d.%d" % (py_v_info[0], py_v_info[1], py_v_info[2])) + print("Simple Rocket is running on Python Vision %s" % py_v) + if py_v_info[0] == 2: + raise Exception("Simple Rocket need python vision 3+") + game = libs.main.Game + game.setup(game) + game.start_game(game) + if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/configs/basic_config.json b/configs/basic_config.json new file mode 100644 index 0000000..fda6d92 --- /dev/null +++ b/configs/basic_config.json @@ -0,0 +1,3 @@ +{ + "language": "zh_cn" +} \ No newline at end of file diff --git a/configs/window.json b/configs/window.json index 4623d8a..2b64535 100644 --- a/configs/window.json +++ b/configs/window.json @@ -1,10 +1,8 @@ { - "size" : { - "x" : "1024", - "y" : "768", - "fullscreen" : "False" - }, - "caption" : "Simple Rocket 0.1", - "visible" : "True", - "style" : "None" + "x": "1024", + "y": "768", + "fullscreen": "False", + "caption": "Simple Rocket 0.1", + "visible": "True", + "style": "None" } \ No newline at end of file diff --git a/docs/configes sample/window.json b/docs/configes sample/window.json index ce1e4e8..1e2cea0 100644 --- a/docs/configes sample/window.json +++ b/docs/configes sample/window.json @@ -1,10 +1,8 @@ { - "size" : { - "x" : "int", - "y" : "int", - "fullscreen" : "bool" - }, - "caption" : "xxx", - "visible" : "bool", - "style" : "xxx(in list)" + "x": "int", + "y": "int", + "fullscreen": "bool", + "caption": "xxx", + "visible": "bool", + "style": "xxx(in list)" } \ No newline at end of file diff --git a/libs/__init__.py b/libs/__init__.py index 43eb41a..894a895 100644 --- a/libs/__init__.py +++ b/libs/__init__.py @@ -4,7 +4,8 @@ mail: 3695888@qq.com """ # import folders import libs.textures +import libs.loads # import in this forder -import libs.startup -import libs.setups +import libs.main +import libs.setup diff --git a/libs/loads.py b/libs/loads.py new file mode 100644 index 0000000..97b2226 --- /dev/null +++ b/libs/loads.py @@ -0,0 +1,24 @@ +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +""" + +import json + + +def config(file_name, stack=None): + rd = {} # rd -> return + try: + with open(file_name, "r") as jf: # jf -> json file + rd = json.load(jf) + except FileNotFoundError: + raise + if stack != None: + rd = rd[stack] + return rd + + +def window_config(): + j_config = config("./configs/window.json") + config_r = (j_config) + return config_r diff --git a/libs/main.py b/libs/main.py new file mode 100644 index 0000000..44c7383 --- /dev/null +++ b/libs/main.py @@ -0,0 +1,31 @@ +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +""" + +import pyglet +import libs + +from pyglet.window import Window +from pyglet.app import run + + +class Game: + def __init__(self): + # value + # dic + self.parts = {} # now ship parts + self.o_parts = {} # stand for opther parts + self.b_g_e = {} # stand for back ground element + self.window_c = libs.loads.window_config() + # list + + def start_game(self): + run() + + def setup(self): + # window + self.window = Window(width=800, height=600, + caption='minecraft PE', resizable=True) + + diff --git a/libs/startup.py b/libs/setup.py similarity index 51% rename from libs/startup.py rename to libs/setup.py index 533c1da..7e1a00d 100644 --- a/libs/startup.py +++ b/libs/setup.py @@ -2,7 +2,3 @@ writen by shenjackyuanjie mail: 3695888@qq.com """ - -class main(): - def __init__(self): - pass diff --git a/libs/setups.py b/libs/setups.py deleted file mode 100644 index e69de29..0000000 diff --git a/libs/textures/__init__.py b/libs/textures/__init__.py index fa23ec2..26d0a8f 100644 --- a/libs/textures/__init__.py +++ b/libs/textures/__init__.py @@ -3,3 +3,5 @@ writen by shenjackyuanjie mail: 3695888@qq.com """ # import folders + +# import in this forder