2020-12-13 18:39:12 +08:00
|
|
|
"""
|
|
|
|
writen by shenjackyuanjie
|
|
|
|
mail: 3695888@qq.com
|
|
|
|
"""
|
|
|
|
|
2021-01-21 15:05:29 +08:00
|
|
|
import multiprocessing as mp
|
2020-12-13 18:39:12 +08:00
|
|
|
|
2021-01-24 22:00:31 +08:00
|
|
|
import bin
|
2021-01-23 21:43:04 +08:00
|
|
|
import pyglet
|
2021-01-11 22:54:41 +08:00
|
|
|
import pyglet.app
|
2020-12-13 18:39:12 +08:00
|
|
|
from pyglet.resource import image
|
2021-01-23 21:43:04 +08:00
|
|
|
from pyglet.window import Window
|
2020-12-13 18:39:12 +08:00
|
|
|
|
2020-12-16 06:33:33 +08:00
|
|
|
|
2021-01-21 15:05:29 +08:00
|
|
|
class RenderThread(mp.Process, pyglet.window.Window):
|
2021-01-11 21:58:51 +08:00
|
|
|
|
2021-01-25 12:22:55 +08:00
|
|
|
def __init__(self, dev_list, dev_dic, logger, net_mode='local'):
|
2021-01-23 21:35:20 +08:00
|
|
|
# do father class __init__()
|
2020-12-21 18:46:20 +08:00
|
|
|
Window.__init__(self)
|
2021-01-21 15:05:29 +08:00
|
|
|
mp.Process.__init__(self)
|
2021-01-25 12:22:55 +08:00
|
|
|
# logging
|
|
|
|
self.logger = logger
|
2020-12-16 06:33:33 +08:00
|
|
|
# value
|
2021-01-28 22:50:28 +08:00
|
|
|
self.process_id = 'Client'
|
|
|
|
self.process_name = 'Client process'
|
2021-01-24 22:00:31 +08:00
|
|
|
# share memory
|
2021-01-21 15:05:29 +08:00
|
|
|
self.dev_list = dev_list
|
|
|
|
self.dev_dic = dev_dic
|
2020-12-16 06:33:33 +08:00
|
|
|
# dic
|
|
|
|
self.parts = {} # this ship parts
|
2021-01-24 22:00:31 +08:00
|
|
|
self.o_parts = {} # stand for other parts
|
2020-12-16 06:33:33 +08:00
|
|
|
self.b_g_e = {} # stand for back ground element
|
|
|
|
self.planet_system = {} # hole planet system
|
|
|
|
# list
|
|
|
|
|
|
|
|
def start_game(self):
|
2021-01-11 22:54:41 +08:00
|
|
|
pyglet.app.run()
|
2020-12-16 06:33:33 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
def setup(self):
|
|
|
|
# dic
|
|
|
|
# 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']),
|
2021-01-24 22:00:31 +08:00
|
|
|
fullscreen=bin.tools.mbool(self.window_c['full_screen']),
|
2020-12-16 06:33:33 +08:00
|
|
|
caption=str(self.window_c['caption']),
|
2021-01-24 22:00:31 +08:00
|
|
|
visible=bin.tools.mbool(self.window_c['visible']))
|
2020-12-16 06:33:33 +08:00
|
|
|
|
|
|
|
def on_draw(self):
|
2021-01-28 19:43:26 +08:00
|
|
|
# render parts
|
2021-01-28 22:07:57 +08:00
|
|
|
for ship in self.parts:
|
2021-01-28 22:50:28 +08:00
|
|
|
ship_poi = ship['brain'][3]
|
2021-01-28 22:07:57 +08:00
|
|
|
for part in ship:
|
|
|
|
pass
|
2020-12-16 06:33:33 +08:00
|
|
|
|
2021-01-28 22:50:28 +08:00
|
|
|
"""
|
|
|
|
keyboard and mouse input
|
|
|
|
"""
|
|
|
|
|
2021-01-24 22:00:31 +08:00
|
|
|
def on_mouse_motion(self, x, y, dx, dy):
|
2020-12-16 06:33:33 +08:00
|
|
|
pass
|
|
|
|
|
2021-01-24 22:00:31 +08:00
|
|
|
def on_key_press(self, symbol, modifiers):
|
2020-12-16 06:33:33 +08:00
|
|
|
pass
|
|
|
|
|
2021-01-24 22:00:31 +08:00
|
|
|
def on_key_release(self, symbol, modifiers):
|
2020-12-16 06:33:33 +08:00
|
|
|
pass
|