Difficult-Rocket/libs/render_thread.py

66 lines
1.8 KiB
Python
Raw Normal View History

2020-12-13 18:39:12 +08:00
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
"""
2020-12-14 22:31:34 +08:00
import libs
2020-12-13 18:39:12 +08:00
import pyglet
import threading
2020-12-21 18:46:20 +08:00
from threading import Thread
2020-12-13 18:39:12 +08:00
from pyglet.app import run
from pyglet.window import Window
from pyglet.resource import image
2020-12-16 06:33:33 +08:00
class RenderThread(threading.Thread, pyglet.window.Window):
2021-01-11 21:58:51 +08:00
def __init__(self, thread_ID, thread_name, delivery_class):
2020-12-21 18:46:20 +08:00
# father class __init__()
Window.__init__(self)
threading.Thread.__init__(self)
2020-12-16 06:33:33 +08:00
# value
2021-01-11 21:58:51 +08:00
self.thread_id = thread_ID
self.thread_name = thread_name
2020-12-16 06:33:33 +08:00
# 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
# list
def start_game(self):
run()
return
def setup(self):
# dic
self.window_c = libs.loads.config(
2021-01-11 21:58:51 +08:00
".\\sys_value\\window.json") # stand for window config
2020-12-16 06:33:33 +08:00
self.planet_c = libs.loads.config(
2021-01-11 21:58:51 +08:00
".\\sys_value\\planet.json") # stand for planet config
2020-12-16 06:33:33 +08:00
self.textures_c = libs.loads.config(
2021-01-11 21:58:51 +08:00
".\\sys_value\\basic_config", "textures") # stand for textures config
2020-12-16 06:33:33 +08:00
# 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-11 21:58:51 +08:00
fullscreen=libs.tools.mbool(
self.window_c['fullscreen']),
2020-12-16 06:33:33 +08:00
caption=str(self.window_c['caption']),
2020-12-21 18:46:20 +08:00
visible=libs.tools.mbool(self.window_c['visible']))
2020-12-16 06:33:33 +08:00
def on_draw(self):
pass
def on_mouse_motion(self):
pass
def on_key_press(self):
pass
def on_key_release(self):
pass