From 54194f69275b35543a92c7998f502654169c9116 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 7 Feb 2023 18:42:41 +0800 Subject: [PATCH] up you go --- Difficult_Rocket/client/render/sr1_ship.py | 15 +++++++++++++++ docs/src/update_logs.md | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/Difficult_Rocket/client/render/sr1_ship.py b/Difficult_Rocket/client/render/sr1_ship.py index 8e00e18..b3eb02c 100644 --- a/Difficult_Rocket/client/render/sr1_ship.py +++ b/Difficult_Rocket/client/render/sr1_ship.py @@ -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: diff --git a/docs/src/update_logs.md b/docs/src/update_logs.md index 53ffba0..e80f101 100644 --- a/docs/src/update_logs.md +++ b/docs/src/update_logs.md @@ -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 淦, 忘记步进版本号了(