Compare commits

..

2 Commits

4 changed files with 32 additions and 10 deletions

View File

@ -24,6 +24,8 @@ class BaseScreen(EventDispatcher):
DR 页面API DR 页面API
""" """
screen_name: str = 'BaseScreen'
def __init__(self, main_window: ClientWindow): def __init__(self, main_window: ClientWindow):
super().__init__() super().__init__()
self.focus = False self.focus = False

View File

@ -132,11 +132,5 @@ class PressTextButton(widgets.WidgetBase):
self.back_rec.height = self._height self.back_rec.height = self._height
... ...
def on_press(self, x, y):
# import random
self.value += "1"
# next_rgb = [random.randint(50, 255) for _ in range(3)]
# self.untouched_color = (*next_rgb, 255)
PressTextButton.register_event_type('on_press') PressTextButton.register_event_type('on_press')

24
mods/dr_game/menu.py Normal file
View File

@ -0,0 +1,24 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
from Difficult_Rocket.client import ClientWindow
from Difficult_Rocket.api.screen import BaseScreen
# from . import DR_mod_runtime
class Menu(BaseScreen):
"""
DR game 菜单
"""
name = 'DR_game_menu'
def __init__(self,
main_window: ClientWindow):
super().__init__(main_window)
# 占位, 高二看看能不能咕出来点啥 (20230911)
# 欸呀, 正好是 911 纪念日哦

View File

@ -10,7 +10,7 @@ import logging
import traceback import traceback
from pathlib import Path from pathlib import Path
from typing import List, TYPE_CHECKING, Dict, Optional, Generator, Tuple from typing import List, Dict, Optional, Generator, Tuple
from pyglet.gl import gl from pyglet.gl import gl
from pyglet.math import Mat4 from pyglet.math import Mat4
@ -66,6 +66,8 @@ class SR1ShipRenderStatus(Options): # NOQA
class SR1ShipRender(BaseScreen): class SR1ShipRender(BaseScreen):
"""用于渲染 sr1 船的类""" """用于渲染 sr1 船的类"""
screen_name = 'DR_game_sr1_ship_render'
def __init__(self, def __init__(self,
main_window: ClientWindow): main_window: ClientWindow):
super().__init__(main_window) super().__init__(main_window)
@ -281,7 +283,8 @@ class SR1ShipRender(BaseScreen):
def draw_batch(self, window: ClientWindow): def draw_batch(self, window: ClientWindow):
if self.status.draw_done: if self.status.draw_done:
self.render_d_label.text = f'x: {self.group_camera.view_x} y: {self.group_camera.view_y}' self.render_d_label.text = f'x: {self.group_camera.view_x} y: {self.group_camera.view_y}'
self.render_d_label.position = self.group_camera.view_x + (self.window_pointer.width / 2), self.group_camera.view_y + ( self.render_d_label.position = self.group_camera.view_x + (
self.window_pointer.width / 2), self.group_camera.view_y + (
self.window_pointer.height / 2) + 10, 0 # 0 for z self.window_pointer.height / 2) + 10, 0 # 0 for z
self.render_d_line.x2 = self.group_camera.view_x self.render_d_line.x2 = self.group_camera.view_x
self.render_d_line.y2 = self.group_camera.view_y self.render_d_line.y2 = self.group_camera.view_y
@ -484,7 +487,6 @@ class SR1ShipRender(BaseScreen):
self.window_pointer.view = value self.window_pointer.view = value
if __name__ == '__main__': if __name__ == '__main__':
from objprint import op from objprint import op