接着整
This commit is contained in:
parent
75fb3237be
commit
4656f8062c
@ -14,10 +14,12 @@ from pyglet.window import Window
|
||||
|
||||
class RenderThread(mp.Process, pyglet.window.Window):
|
||||
|
||||
def __init__(self, dev_list, dev_dic, net_mode='local'):
|
||||
def __init__(self, dev_list, dev_dic, logger, net_mode='local'):
|
||||
# do father class __init__()
|
||||
Window.__init__(self)
|
||||
mp.Process.__init__(self)
|
||||
# logging
|
||||
self.logger = logger
|
||||
# value
|
||||
self.process_id = 'Render'
|
||||
self.process_name = 'render process'
|
||||
@ -46,6 +48,10 @@ class RenderThread(mp.Process, pyglet.window.Window):
|
||||
caption=str(self.window_c['caption']),
|
||||
visible=bin.tools.mbool(self.window_c['visible']))
|
||||
|
||||
"""
|
||||
keyboard and mouse input
|
||||
"""
|
||||
|
||||
def on_draw(self):
|
||||
pass
|
||||
|
||||
|
21
bin/main.py
21
bin/main.py
@ -3,21 +3,32 @@ writen by shenjackyuanjie
|
||||
mail: 3695888@qq.com
|
||||
"""
|
||||
|
||||
# share memory
|
||||
from multiprocessing import Manager as share
|
||||
|
||||
import bin
|
||||
import time
|
||||
import logging
|
||||
|
||||
# 直接导入
|
||||
import server
|
||||
import client
|
||||
|
||||
# get time when the program to start the logging
|
||||
start_time = time.time()
|
||||
start_time_date = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(start_time))
|
||||
|
||||
# ---------- option start ----------
|
||||
log_level = logging.DEBUG # log level
|
||||
|
||||
|
||||
class Game():
|
||||
|
||||
def __init__(self):
|
||||
self.start_time = time.strftime("%Y-%m-%d %H-%M-%S", time.gmtime(start_time))
|
||||
self.dics = share().dict()
|
||||
self.lists = share().list()
|
||||
self.client = client.RenderThread(self.lists, self.dics, net_mode='local')
|
||||
self.server = server.server(self.lists, self.dics, net_mode='local')
|
||||
|
||||
def setup(self):
|
||||
pass
|
||||
self.server_logger = logging.getLogger('server')
|
||||
self.client_logger = logging.getLogger('client')
|
||||
self.client = client.RenderThread(self.lists, self.dics, self.client_logger, net_mode='local')
|
||||
self.server = server.server(self.lists, self.dics, self.server_logger, net_mode='local')
|
||||
|
@ -7,9 +7,11 @@ import multiprocessing as mp
|
||||
|
||||
|
||||
class server(mp.Process):
|
||||
def __init__(self, dev_list, dev_dic, net_mode='local'):
|
||||
def __init__(self, dev_list, dev_dic, logger, net_mode='local'):
|
||||
# father class __init__()
|
||||
mp.Process.__init__(self)
|
||||
# logging
|
||||
self.logger = logger
|
||||
# value
|
||||
self.process_id = 'Server'
|
||||
self.process_name = 'server process'
|
||||
|
@ -1,21 +1,38 @@
|
||||
{
|
||||
"language": "language",
|
||||
"textures": {
|
||||
"back_ground_space": "xxx.png",
|
||||
"planet": {
|
||||
"xxx": "xxx.png"
|
||||
},
|
||||
"flame": {
|
||||
"xxx": "xxx.png"
|
||||
}
|
||||
'language': 'language',
|
||||
'textures': {
|
||||
'back_ground_space': 'xxx.png',
|
||||
'planet': {
|
||||
'xxx': 'xxx.png'
|
||||
},
|
||||
"basic_number": {
|
||||
"name": ["float", "int", ["unit"], ["unit"], "name = float × 10^int × unit(s) ÷ unit(s)"]
|
||||
},
|
||||
"basic_force" : {
|
||||
"name": ["x", "y", "x&y format:basic_number/unit1:[m]/unit2:[]"]
|
||||
},
|
||||
"basic_poi": {
|
||||
"name": ["x", "y"]
|
||||
'flame': {
|
||||
'xxx': 'xxx.png'
|
||||
}
|
||||
},
|
||||
'basic_number': {
|
||||
'name': [
|
||||
'float',
|
||||
'int',
|
||||
[
|
||||
'unit'
|
||||
],
|
||||
[
|
||||
'unit'
|
||||
],
|
||||
'name = float × 10^int × unit(s) ÷ unit(s)'
|
||||
]
|
||||
},
|
||||
'basic_force': {
|
||||
'name': [
|
||||
'x',
|
||||
'y',
|
||||
'x&y format:basic_number/unit1:[m]/unit2:[]'
|
||||
]
|
||||
},
|
||||
'basic_poi': {
|
||||
'name': [
|
||||
'x',
|
||||
'y'
|
||||
]
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
{
|
||||
"Game_threads": {
|
||||
"orbit_demo": {
|
||||
"ship_info": {
|
||||
"mass": "basic_config:basic_number",
|
||||
"force": "basic_config:basic_force"
|
||||
}
|
||||
}
|
||||
'Game_threads': {
|
||||
'orbit_demo': {
|
||||
'ship_info': {
|
||||
'mass': 'basic_config:basic_number',
|
||||
'force': 'basic_config:basic_force'
|
||||
}
|
||||
}
|
||||
},
|
||||
'client': {
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"keys" : {
|
||||
"function-1" : "keys-1",
|
||||
"function-2" : "keys-2"
|
||||
}
|
||||
'keys': {
|
||||
'function-1': 'keys-1',
|
||||
'function-2': 'keys-2'
|
||||
}
|
||||
}
|
@ -1,13 +1,17 @@
|
||||
{
|
||||
"System name": {
|
||||
"description": "xxx",
|
||||
"planets": {
|
||||
"planets xxx": {
|
||||
"description": "xxx",
|
||||
"gravity": "x.xx N/kg",
|
||||
"radius": "xxx m",
|
||||
"map_color": ["R", "G", "B"]
|
||||
}
|
||||
}
|
||||
'System name': {
|
||||
'description': 'xxx',
|
||||
'planets': {
|
||||
'planets xxx': {
|
||||
'description': 'xxx',
|
||||
'gravity': 'x.xx N/kg',
|
||||
'radius': 'xxx m',
|
||||
'map_color': [
|
||||
'R',
|
||||
'G',
|
||||
'B'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"width": "int",
|
||||
"height": "int",
|
||||
"full_screen": "true/false",
|
||||
'width': 'int',
|
||||
'height': 'int',
|
||||
'full_screen': 'true/false',
|
||||
// bool
|
||||
"caption": "xxx",
|
||||
'caption': 'xxx',
|
||||
// {version} -> version of SR
|
||||
"resizable": "true",
|
||||
'resizable': 'true',
|
||||
// bool
|
||||
"visible": "true",
|
||||
'visible': 'true',
|
||||
// bool
|
||||
"style": "xxx(in list)"
|
||||
'style': 'xxx(in list)'
|
||||
}
|
@ -1,17 +1,29 @@
|
||||
{
|
||||
"language": "zh_cn",
|
||||
"textures": {
|
||||
"back_ground_space": "back_ground_space.png",
|
||||
"planet": {
|
||||
"earth_ground": "earth_ground.png"
|
||||
},
|
||||
"flame": {
|
||||
"liquid": "liquid_engine_flame.png",
|
||||
"soild": "soild_engine_flame.png",
|
||||
"ion": "ion_engine_flame.png"
|
||||
}
|
||||
'language': 'zh_cn',
|
||||
'textures': {
|
||||
'back_ground_space': 'back_ground_space.png',
|
||||
'planet': {
|
||||
'earth_ground': 'earth_ground.png'
|
||||
},
|
||||
"basic_number": {
|
||||
"G" : [6.67, -11, ["N", "m", "m"], ["kg", "kg"]]
|
||||
'flame': {
|
||||
'liquid': 'liquid_engine_flame.png',
|
||||
'solid': 'solid_engine_flame.png',
|
||||
'ion': 'ion_engine_flame.png'
|
||||
}
|
||||
},
|
||||
'basic_number': {
|
||||
'G': [
|
||||
6.67,
|
||||
-11,
|
||||
[
|
||||
'N',
|
||||
'm',
|
||||
'm'
|
||||
],
|
||||
[
|
||||
'kg',
|
||||
'kg'
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
@ -1,13 +1,17 @@
|
||||
{
|
||||
"Solar System": {
|
||||
"description": "",
|
||||
"planets": {
|
||||
"smearth": {
|
||||
"description": "",
|
||||
"gravity": 9.81,
|
||||
"radius": 63710000,
|
||||
"map_color": [103, 157, 255]
|
||||
}
|
||||
}
|
||||
'Solar System': {
|
||||
'description': '',
|
||||
'planets': {
|
||||
'earth': {
|
||||
'description': '',
|
||||
'gravity': 9.81,
|
||||
'radius': 63710000,
|
||||
'map_color': [
|
||||
103,
|
||||
157,
|
||||
255
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"width": "1024",
|
||||
"height": "768",
|
||||
"full_screen": "false",
|
||||
'width': '1024',
|
||||
'height': '768',
|
||||
'full_screen': 'false',
|
||||
// bool
|
||||
"caption": "Simple Rocket {version}",
|
||||
'caption': 'Simple Rocket {version}',
|
||||
// {version} -> version of SR
|
||||
"resizable": "true",
|
||||
'resizable': 'true',
|
||||
// bool
|
||||
"visible": "true",
|
||||
'visible': 'true',
|
||||
// bool
|
||||
"style": "None"
|
||||
'style': 'None'
|
||||
}
|
Loading…
Reference in New Issue
Block a user