From bb3cbb59c47aa733b375dd73b16918e47ef25734 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, 24 Jan 2021 22:00:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E4=BB=80=E4=B9=88=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E4=B8=8D=E8=BF=87=E6=8D=A2=E5=88=B0pycharm=E7=BD=A2=E4=BA=86?= =?UTF-8?q?=EF=BC=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/__init__.py | 8 ++++---- bin/client.py | 16 ++++++++-------- bin/main.py | 9 ++++++--- docs/configes sample/window.json5 | 14 +++++++------- sys_value/window.json5 | 14 +++++++------- test_mutiproser.py | 7 ++++--- test_threading.py | 5 +++-- 7 files changed, 39 insertions(+), 34 deletions(-) diff --git a/bin/__init__.py b/bin/__init__.py index 6a8a702..3b39b3d 100644 --- a/bin/__init__.py +++ b/bin/__init__.py @@ -5,10 +5,10 @@ mail: 3695888@qq.com # import folders # -import client -import configs -import delivery # import in this folder import main -import server import tools +import client +import server +import configs +import delivery diff --git a/bin/client.py b/bin/client.py index f6c4467..9eedf5f 100644 --- a/bin/client.py +++ b/bin/client.py @@ -5,7 +5,7 @@ mail: 3695888@qq.com import multiprocessing as mp -import libs +import bin import pyglet import pyglet.app from pyglet.resource import image @@ -21,12 +21,12 @@ class RenderThread(mp.Process, pyglet.window.Window): # value self.process_id = 'Render' self.process_name = 'render process' - # share memery + # share memory self.dev_list = dev_list self.dev_dic = dev_dic # dic self.parts = {} # this ship parts - self.o_parts = {} # stand for opther parts + self.o_parts = {} # stand for other parts self.b_g_e = {} # stand for back ground element self.planet_system = {} # hole planet system # list @@ -42,18 +42,18 @@ class RenderThread(mp.Process, pyglet.window.Window): # 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=bin.tools.mbool(self.window_c['full_screen']), caption=str(self.window_c['caption']), - visible=libs.tools.mbool(self.window_c['visible'])) + visible=bin.tools.mbool(self.window_c['visible'])) def on_draw(self): pass - def on_mouse_motion(self): + def on_mouse_motion(self, x, y, dx, dy): pass - def on_key_press(self): + def on_key_press(self, symbol, modifiers): pass - def on_key_release(self): + def on_key_release(self, symbol, modifiers): pass diff --git a/bin/main.py b/bin/main.py index 52df041..66f0967 100644 --- a/bin/main.py +++ b/bin/main.py @@ -5,7 +5,10 @@ mail: 3695888@qq.com from multiprocessing import Manager as share -import libs +import bin + +import server +import client class Game(): @@ -13,8 +16,8 @@ class Game(): def __init__(self): self.dics = share().dict() self.lists = share().list() - self.client = libs.libs.client() - self.server = libs.libs.server() + self.client = client.RenderThread(self.lists, self.dics) + self.server = server.server(self.lists, self.dics) def setup(self): pass diff --git a/docs/configes sample/window.json5 b/docs/configes sample/window.json5 index 0f34c29..b09b605 100644 --- a/docs/configes sample/window.json5 +++ b/docs/configes sample/window.json5 @@ -1,9 +1,9 @@ { - "width": "int", - "height": "int", - "fullscreen": "`1/0`", - "caption": "xxx", - "resizable":"1/0", - "visible": "1/0", - "style": "xxx(in list)" + "width": "int", + "height": "int", + "full_screen": "`1/0`", + "caption": "xxx", + "resizable": "1/0", + "visible": "1/0", + "style": "xxx(in list)" } \ No newline at end of file diff --git a/sys_value/window.json5 b/sys_value/window.json5 index 18ec77a..3c79860 100644 --- a/sys_value/window.json5 +++ b/sys_value/window.json5 @@ -1,9 +1,9 @@ { - "width": "1024", - "height": "768", - "fullscreen": "0", - "caption": "Simple Rocket 0.1", - "resizable":"1", - "visible": "1", - "style": "None" + "width": "1024", + "height": "768", + "full_screen": "0", + "caption": "Simple Rocket 0.1", + "resizable": "1", + "visible": "1", + "style": "None" } \ No newline at end of file diff --git a/test_mutiproser.py b/test_mutiproser.py index 1f55c43..5ec03a5 100644 --- a/test_mutiproser.py +++ b/test_mutiproser.py @@ -1,8 +1,9 @@ + import multiprocessing as mp -import os -import random -import time from multiprocessing.context import Process +import os +import time +import random class Main(mp.Process): diff --git a/test_threading.py b/test_threading.py index 43f37d3..2141df2 100644 --- a/test_threading.py +++ b/test_threading.py @@ -1,7 +1,8 @@ -import os -import random import threading import time +import os +import sys +import random class Aclass(threading.Thread):