2020-12-05 21:24:54 +08:00
|
|
|
"""
|
|
|
|
writen by shenjackyuanjie
|
|
|
|
mail: 3695888@qq.com
|
|
|
|
"""
|
|
|
|
|
|
|
|
import pyglet
|
|
|
|
import libs
|
|
|
|
|
2020-12-05 22:21:27 +08:00
|
|
|
from pyglet.app import run
|
|
|
|
from pyglet.window import Window
|
2020-12-06 22:28:18 +08:00
|
|
|
from pyglet.resource import image
|
2020-12-05 22:21:27 +08:00
|
|
|
|
2020-12-05 21:24:54 +08:00
|
|
|
|
2020-12-06 22:28:18 +08:00
|
|
|
def mbool(thing): # stand for my bool
|
|
|
|
if (thing == "True") or (thing == 1) or (thing == "1"):
|
|
|
|
return True
|
|
|
|
elif (thing == "False") or (thing == 0) or (thing == "0"):
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
raise ValueError("Need a 'like bool' not anything else")
|
|
|
|
|
2020-12-05 21:24:54 +08:00
|
|
|
class Game:
|
|
|
|
def __init__(self):
|
|
|
|
# value
|
|
|
|
# dic
|
|
|
|
self.parts = {} # now ship parts
|
|
|
|
self.o_parts = {} # stand for opther parts
|
|
|
|
self.b_g_e = {} # stand for back ground element
|
|
|
|
# list
|
|
|
|
|
|
|
|
def start_game(self):
|
2020-12-05 22:21:27 +08:00
|
|
|
run()
|
2020-12-06 22:28:18 +08:00
|
|
|
return
|
2020-12-05 21:24:54 +08:00
|
|
|
|
|
|
|
def setup(self):
|
2020-12-05 22:21:27 +08:00
|
|
|
# dic
|
2020-12-05 23:19:00 +08:00
|
|
|
self.window_c = libs.loads.config(".\\configs\\window.json")
|
2020-12-06 22:28:18 +08:00
|
|
|
self.tc = libs.loads.config(".\\configs\\basic_config", "textures")
|
|
|
|
# image
|
|
|
|
self.b_g = image("")
|
2020-12-05 21:24:54 +08:00
|
|
|
# window
|
2020-12-05 22:21:27 +08:00
|
|
|
self.window = Window(width=int(self.window_c['width']),
|
|
|
|
height=int(self.window_c['height']),
|
2020-12-06 22:28:18 +08:00
|
|
|
fullscreen=mbool(self.window_c['fullscreen']),
|
2020-12-05 23:15:31 +08:00
|
|
|
caption=str(self.window_c['caption']),
|
2020-12-06 22:28:18 +08:00
|
|
|
visible=mbool(self.window_c['visible']))
|