修复了目前的一些问题(就是懒得具体看了
This commit is contained in:
parent
649cd4cd9c
commit
d191a3650c
@ -116,8 +116,8 @@ class BaseScreen(EventDispatcher, Options):
|
||||
:event:
|
||||
"""
|
||||
|
||||
def on_draw(self, dt: float, window: ClientWindow): # TODO: wait for pyglet 2.1
|
||||
# def on_draw(self, window: ClientWindow):
|
||||
# def on_draw(self, dt: float, window: ClientWindow): # TODO: wait for pyglet 2.1
|
||||
def on_draw(self, window: ClientWindow):
|
||||
"""The window contents must be redrawn.
|
||||
|
||||
The `EventLoop` will dispatch this event when the window
|
||||
|
@ -285,7 +285,6 @@ class ClientWindow(Window):
|
||||
self.push_handlers(self.input_box)
|
||||
self.input_box.enabled = True
|
||||
# 设置刷新率
|
||||
# pyglet.clock.schedule_interval(self.draw_update, float(self.SPF))
|
||||
# 完成设置后的信息输出
|
||||
self.logger.info(tr().window.os.pid_is().format(os.getpid(), os.getppid()))
|
||||
end_time = time.time_ns()
|
||||
@ -295,7 +294,7 @@ class ClientWindow(Window):
|
||||
self.logger.debug(tr().window.setup.use_time_ns().format(self.use_time))
|
||||
|
||||
def setup(self):
|
||||
self.set_icon(pyglet.image.load("assets/textures/icon.png"))
|
||||
self.set_icon(pyglet.image.load("assets/textures/icon.ico"))
|
||||
self.load_fonts()
|
||||
self.screen_list["DR_debug"] = DRDEBUGScreen(self)
|
||||
self.game.dispatch_mod_event("on_client_start", game=self.game, client=self)
|
||||
@ -307,10 +306,9 @@ class ClientWindow(Window):
|
||||
pyglet_load_fonts_folder(fonts_folder_path)
|
||||
|
||||
def start_game(self) -> None:
|
||||
self.set_icon(pyglet.image.load("assets/textures/icon.png"))
|
||||
try:
|
||||
pyglet.clock.schedule_interval(self.draw_call, float(self.SPF))
|
||||
pyglet.app.run(None)
|
||||
# pyglet.clock.schedule(self.draw_call)
|
||||
pyglet.app.run(0)
|
||||
except KeyboardInterrupt:
|
||||
self.logger.warn(
|
||||
"==========client stop. KeyboardInterrupt info==========", tag="starter"
|
||||
@ -356,17 +354,17 @@ class ClientWindow(Window):
|
||||
now_FPS = pyglet.clock.get_frequency()
|
||||
self.fps_log.update_tick(now_FPS, decimal_tick)
|
||||
|
||||
def draw_call(self, dt: float):
|
||||
def draw_call(self):
|
||||
self.switch_to()
|
||||
self.on_draw(dt)
|
||||
self.on_draw()
|
||||
self.flip()
|
||||
|
||||
@_call_screen_after
|
||||
def on_draw(self, dt: float):
|
||||
def on_draw(self, *dt: float):
|
||||
while (command := self.game.console.get_command()) is not None:
|
||||
self.on_command(line.CommandText(command))
|
||||
self.clear()
|
||||
self.draw_update(dt)
|
||||
self.draw_update(float(self.SPF))
|
||||
self.draw_batch()
|
||||
|
||||
@_call_screen_after
|
||||
|
@ -4,16 +4,19 @@
|
||||
# All rights reserved
|
||||
# -------------------------------
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Optional, Tuple, Type
|
||||
|
||||
# from libs import pyglet
|
||||
import pyglet
|
||||
from pyglet.gl import GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA
|
||||
from pyglet.graphics.shader import ShaderProgram
|
||||
from pyglet.text import Label
|
||||
from pyglet.gui import widgets
|
||||
from pyglet.window import mouse
|
||||
|
||||
# from pyglet.sprite import Sprite
|
||||
from pyglet.shapes import Rectangle, BorderedRectangle
|
||||
from pyglet.shapes import Rectangle, BorderedRectangle, ShapeBase
|
||||
|
||||
# from pyglet.image import AbstractImage
|
||||
from pyglet.graphics import Batch, Group
|
||||
@ -22,9 +25,12 @@ from Difficult_Rocket.api.types import Options, FontData
|
||||
|
||||
# from Difficult_Rocket import DR_status
|
||||
|
||||
|
||||
RGBA = Tuple[int, int, int, int]
|
||||
|
||||
class 拐角(ShapeBase):
|
||||
def __init__(self, vertex_count: int, blend_src: int = ..., blend_dest: int = ..., batch: Batch | None = None, group: Group | None = None, program: ShaderProgram | None = None) -> None:
|
||||
super().__init__(vertex_count, blend_src, blend_dest, batch, group, program)
|
||||
|
||||
|
||||
class BaseButtonTheme:
|
||||
"""
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f68bd5b57d2ece430ebbabb7b405eb4b821fb567
|
||||
Subproject commit 60da39e4e8eac50dc58024545b298a7bc7e55d36
|
@ -132,5 +132,6 @@ class Menu(BaseScreen):
|
||||
# main_window.push_handlers(self.button3)
|
||||
main_window.push_handlers(self.enter_ship_editor_button)
|
||||
|
||||
def on_draw(self, dt: float, window: ClientWindow):
|
||||
# def on_draw(self, dt: float, window: ClientWindow): # TODO: wait for pyglet 2.1
|
||||
def on_draw(self, window: ClientWindow):
|
||||
self.main_batch.draw()
|
||||
|
@ -531,8 +531,8 @@ class SR1ShipEditor(BaseScreen):
|
||||
gl.glScissor(0, 0, self.window_pointer.width, self.window_pointer.height)
|
||||
gl.glDisable(gl.GL_SCISSOR_TEST)
|
||||
|
||||
def on_draw(self, dt: float, window): # TODO: wait for pyglet 2.1
|
||||
# def on_draw(self, window: ClientWindow):
|
||||
# def on_draw(self, dt: float, window): # TODO: wait for pyglet 2.1
|
||||
def on_draw(self, window: ClientWindow):
|
||||
if self.status.draw_call:
|
||||
self.render_ship()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user