提交 7bc08933 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 5fa29dda
......@@ -30,6 +30,7 @@ class BodyTrail(Entity):
model='sphere',
collider='sphere',
ignore_paused=True,
# highlight_color=color.red, # Button 有效
**kwargs
)
......
......@@ -210,6 +210,24 @@ class ControlHandler(EventHandler):
def on_slider_run_speed_changed(self):
UrsinaConfig.run_speed_factor = self.ui.slider_run_speed_factor.value
def shift_key_handle(self, key):
"""
用于判断是否按下 shift 键盘
@param key:
@return:
"""
if not hasattr(self, "shift_keys"):
self.shift_keys = {"right": False, "left": False}
if key in ["right shift hold", "left shift hold"]:
kv = key.split(" ")
self.shift_keys[kv[0]] = True
elif key in ["right shift up", "left shift up"]:
kv = key.split(" ")
self.shift_keys[kv[0]] = False
print(self.shift_keys)
return self.shift_keys['left'] or self.shift_keys['right']
def settings_handler_input(self, key):
"""
......@@ -218,9 +236,12 @@ class ControlHandler(EventHandler):
"""
import sys
self.camera_update()
self.shift_key_handle(key)
self.camera_update()
print(key)
if key == "escape":
if self.shift_keys['left'] or self.shift_keys['right']:
sys.exit()
# print(key)
elif key == 'space':
......
......@@ -232,7 +232,11 @@ class UrsinaSimulator(Simulator):
camera.fov = 60
window.fps_counter.enabled = False
window.editor_ui.enabled = True
window.editor_ui.enabled = False
# # 场景加入雾的效果
# scene.fog_color = color.orange
# scene.fog_density = 800 * UrsinaConfig.SCALE_FACTOR
# UrsinaConfig.SCALE_FACTOR = UrsinaConfig.SCALE_FACTOR * math.ceil(0.01 / pow(camera.clip_plane_near,2))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册