up you go

This commit is contained in:
shenjack 2023-02-07 18:42:41 +08:00
parent 6b05d87828
commit 54194f6927
2 changed files with 22 additions and 0 deletions

View File

@ -307,6 +307,21 @@ class SR1ShipRender(BaseScreen):
SR1ShipRender_Option.debug_mouse_d_pos = not SR1ShipRender_Option.debug_mouse_d_pos
self.debug_mouse_delta_line.visible = SR1ShipRender_Option.debug_mouse_d_pos
# print('sr1 mouse')
elif command.re_match('get_buf'):
import pyglet
def screenshot(window):
from libs.pyglet.gl.gl import GLubyte, GL_RGBA, GL_UNSIGNED_BYTE, glReadPixels
width = window.width
height = window.height
format_str = "RGBA"
buf = (GLubyte * (len(format_str) * width * height))()
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf)
# print(buf)
return pyglet.image.ImageData(width, height, format_str, buf)
image_data = screenshot(self.window_pointer)
image_data.save('test.png')
def on_mouse_drag(self, x: int, y: int, dx: int, dy: int, buttons: int, modifiers: int):
if not self.focus:

View File

@ -17,6 +17,13 @@
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
- Using [SemVer 2.0.0](https://semver.org/) to manage version
## 2023 V 0.7.0.3
### 命令
- `get_buf`
- 用于截屏 并将文件保存至根目录下面的 `test.png`
## 20230207 V 0.7.0.2
淦, 忘记步进版本号了(