From 82ce83ea738a312993920a86e65a94b6d83812f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E7=91=97=E6=9D=B0?= <3695888@qq.com> Date: Sun, 13 Dec 2020 18:39:12 +0800 Subject: [PATCH] well time to MAKE THREAD! --- libs/Game_threads/__init__.py | 12 ++++++++++++ libs/Game_threads/orbit_demo.py | 11 +++++++++++ libs/__init__.py | 3 --- libs/main.py | 25 +++++++++++++++++-------- libs/render.py | 15 +++++++++++++++ 5 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 libs/Game_threads/__init__.py create mode 100644 libs/Game_threads/orbit_demo.py create mode 100644 libs/render.py diff --git a/libs/Game_threads/__init__.py b/libs/Game_threads/__init__.py new file mode 100644 index 0000000..9d52895 --- /dev/null +++ b/libs/Game_threads/__init__.py @@ -0,0 +1,12 @@ +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +""" +# import folders +import libs.Game_threads + +# import in this forder +import libs.main +import libs.loads +import libs.setup +import libs.render diff --git a/libs/Game_threads/orbit_demo.py b/libs/Game_threads/orbit_demo.py new file mode 100644 index 0000000..22d48c9 --- /dev/null +++ b/libs/Game_threads/orbit_demo.py @@ -0,0 +1,11 @@ +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +""" + +import libs +import threading + +class Orbit_demo(threading.Thread): + def __init__(self): + pass \ No newline at end of file diff --git a/libs/__init__.py b/libs/__init__.py index a3ff8f9..26d0a8f 100644 --- a/libs/__init__.py +++ b/libs/__init__.py @@ -5,6 +5,3 @@ mail: 3695888@qq.com # import folders # import in this forder -import libs.main -import libs.loads -import libs.setup diff --git a/libs/main.py b/libs/main.py index 772841e..f0d92bf 100644 --- a/libs/main.py +++ b/libs/main.py @@ -12,7 +12,7 @@ from pyglet.window import Window from pyglet.resource import image -def mbool(thing): # stand for my bool +def mbool(thing): # stand for my bool if (thing == "True") or (thing == 1) or (thing == "1"): return True elif (thing == "False") or (thing == 0) or (thing == "0"): @@ -20,14 +20,20 @@ def mbool(thing): # stand for my bool else: raise ValueError("Need a 'like bool' not anything else") -class Game: + +class Game(): def __init__(self): + pass + + +class RenderThread(threading.Thread): + def __init__(self,): # value # dic self.parts = {} # this ship parts self.o_parts = {} # stand for opther parts self.b_g_e = {} # stand for back ground element - self.planet_system = {} # hole planet system + self.planet_system = {} # hole planet system # list def start_game(self): @@ -36,17 +42,20 @@ class Game: def setup(self): # dic - self.window_c = libs.loads.config(".\\configs\\window.json") # stand for window config - self.planet_c = libs.loads.config(".\\configs\\planet.json") # stand for planet config - self.textures_c = libs.loads.config(".\\configs\\basic_config", "textures") # stand for textures config + self.window_c = libs.loads.config( + ".\\configs\\window.json") # stand for window config + self.planet_c = libs.loads.config( + ".\\configs\\planet.json") # stand for planet config + self.textures_c = libs.loads.config( + ".\\configs\\basic_config", "textures") # stand for textures config # image self.b_g = image("back_ground_space.png") # window - self.window = Window(width=int(self.window_c['width']), + self.window = Window(width=int(self.window_c['width']), height=int(self.window_c['height']), fullscreen=mbool(self.window_c['fullscreen']), caption=str(self.window_c['caption']), visible=mbool(self.window_c['visible'])) - + def on_draw(self): pass diff --git a/libs/render.py b/libs/render.py new file mode 100644 index 0000000..c83ff5c --- /dev/null +++ b/libs/render.py @@ -0,0 +1,15 @@ +""" +writen by shenjackyuanjie +mail: 3695888@qq.com +""" + +import pyglet +import threading + +from pyglet.app import run +from pyglet.window import Window +from pyglet.resource import image + +class RenderThread(threading.Thread): + def __init__(self): + pass \ No newline at end of file