This commit is contained in:
沈瑗杰 2021-01-21 15:05:29 +08:00
parent 024d96dec6
commit b291476d18
6 changed files with 40 additions and 23 deletions

View File

@ -5,7 +5,6 @@ mail: 3695888@qq.com
import pyglet
import libs
import json
import sys
import os

View File

@ -14,3 +14,4 @@ import libs.setup
import libs.configs
import libs.delivery
import libs.render_thread
import libs.compute_thread

23
libs/compute_thread.py Normal file
View File

@ -0,0 +1,23 @@
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
"""
import libs
import threading
import multiprocessing as mp
class compute_thread(mp.Process):
def __init__(self, dev_list, dev_dic):
# father class __init__()
mp.Process.__init__(self)
# value
self.process_id = 'Compute'
self.process_name = 'compute process'
# share memery
self.dev_list = dev_list
self.dev_dic = dev_dic
def run(self):
pass

View File

@ -6,7 +6,6 @@ mail: 3695888@qq.com
class Delivery:
def __init__(self):
# bool
self.using = False
self.rended = False

View File

@ -6,16 +6,17 @@ mail: 3695888@qq.com
from libs.Game_threads import orbit_demo
import libs
import pyglet
import threading
import multiprocessing
import multiprocessing as mp
from multiprocessing import Manager as share
class Game():
def __init__(self):
pass
self.dics = share().dict()
self.lists = share().list()
self.render = libs.libs.render_thread.RenderThread(self.lists, self.dics)
def setup(self):
self.game_thread = orbit_demo()

View File

@ -6,22 +6,25 @@ mail: 3695888@qq.com
import libs
import pyglet
import threading
import multiprocessing
import multiprocessing as mp
import pyglet.app
from pyglet.window import Window
from pyglet.resource import image
class RenderThread(threading.Thread, pyglet.window.Window):
class RenderThread(mp.Process, pyglet.window.Window):
def __init__(self, thread_ID, thread_name, delivery_class):
def __init__(self, dev_list, dev_dic):
# father class __init__()
Window.__init__(self)
threading.Thread.__init__(self)
mp.Process.__init__(self)
# value
self.thread_id = thread_ID
self.thread_name = thread_name
self.process_id = 'Render'
self.process_name = 'render process'
# share memery
self.dev_list = dev_list
self.dev_dic = dev_dic
# dic
self.parts = {} # this ship parts
self.o_parts = {} # stand for opther parts
@ -35,21 +38,12 @@ class RenderThread(threading.Thread, pyglet.window.Window):
def setup(self):
# dic
"""
self.window_c = libs.loads.config(
".\\sys_value\\window.json") # stand for window config
self.planet_c = libs.loads.config(
".\\sys_value\\planet.json") # stand for planet config
self.textures_c = libs.loads.config(
".\\sys_value\\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']),
height=int(self.window_c['height']),
fullscreen=libs.tools.mbool(
self.window_c['fullscreen']),
fullscreen=libs.tools.mbool(self.window_c['fullscreen']),
caption=str(self.window_c['caption']),
visible=libs.tools.mbool(self.window_c['visible']))