diff --git a/README.md b/README.md index a47b730..80c47ee 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ ## 请注意 这个仓库未来只会发布 `DR SDK` 的更新 `DR game` 的更新会在 [这里](https://github.com/shenjackyuanjie/DR-game) 发布 +![demo](docs/src/demo.png) + 996.icu [![Generic badge](https://img.shields.io/badge/SemVer-2.0.0-blue.svg)](https://Semver.org/) [![Generic badge](https://img.shields.io/badge/编写于_Python_版本-3.8.10-blue.svg)](https://Python.org) diff --git a/docs/README-en.md b/docs/README-en.md index abac44f..ffb8c4b 100644 --- a/docs/README-en.md +++ b/docs/README-en.md @@ -9,6 +9,8 @@ ## Notice: This repo will only publish `DR SDK` updates, `DR game` updates will be published [here](https://github.com/shenjackyuanjie/DR-game) +![demo](/src/demo.png) + 996.icu [![Generic badge](https://img.shields.io/badge/SemVer-2.0.0-blue.svg)](https://Semver.org/) [![Generic badge](https://img.shields.io/badge/Write_with_Python-3.8.10-blue.svg)](https://Python.org) diff --git a/docs/src/demo.png b/docs/src/demo.png new file mode 100644 index 0000000..9d5eae9 Binary files /dev/null and b/docs/src/demo.png differ diff --git a/mods/dr_game/sr1_ship.py b/mods/dr_game/sr1_ship.py index 47e5159..367f11a 100644 --- a/mods/dr_game/sr1_ship.py +++ b/mods/dr_game/sr1_ship.py @@ -12,7 +12,7 @@ import traceback from pathlib import Path from typing import List, TYPE_CHECKING, Dict, Optional, Generator, Tuple -from pyglet.math import Vec4 +from pyglet.math import Vec4, Mat4 from pyglet.text import Label from pyglet.sprite import Sprite from pyglet.graphics import Batch, Group @@ -73,14 +73,14 @@ class SR1ShipRender(BaseScreen): self.dx = 0 self.dy = 0 - self.width = main_window.width - 100 - self.height = main_window.height - 100 + self.width = main_window.width + self.height = main_window.height self.buffer = Framebuffer() self.render_texture = Texture.create(self.width, self.height) self.buffer.attach_texture(self.render_texture) self.main_batch = Batch() - self.group_camera = CenterGroupCamera(window=main_window, + self.group_camera = CenterGroupCamera(window=self, order=10, parent=main_window.main_group, min_zoom=(1 / 2) ** 10, @@ -314,8 +314,8 @@ class SR1ShipRender(BaseScreen): if not self.status.draw_done: return if self.status.focus: - mouse_dx = x - (window.width / 2) - mouse_dy = y - (window.height / 2) + mouse_dx = x - (self.width / 2) + self.dx + mouse_dy = y - (self.height / 2) + self.dy # 鼠标缩放位置相对于屏幕中心的位置 mouse_dx_d = mouse_dx - self.group_camera.view_x mouse_dy_d = mouse_dy - self.group_camera.view_y @@ -468,6 +468,14 @@ class SR1ShipRender(BaseScreen): # break # self.render_ship() + @property + def view(self): + return self.window_pointer.view + + @view.setter + def view(self, value: Mat4): + self.window_pointer.view = value + if __name__ == '__main__': from objprint import op