From 2aa19fce4941ac0e4f0e09954ab7b4aa38b1695c Mon Sep 17 00:00:00 2001 From: shenjack-mac <3695888@qq.com> Date: Wed, 8 Feb 2023 21:39:06 +0800 Subject: [PATCH] ruaaaaa --- Difficult_Rocket/client/render/sr1_ship.py | 19 ++++------ configs/main.toml | 4 +-- libs/Difficult_Rocket_rs/src/src/lib.rs | 2 +- libs/Difficult_Rocket_rs/src/src/render.rs | 42 ---------------------- libs/Difficult_Rocket_rs/src/src/types.rs | 15 ++++++++ 5 files changed, 25 insertions(+), 57 deletions(-) create mode 100644 libs/Difficult_Rocket_rs/src/src/types.rs diff --git a/Difficult_Rocket/client/render/sr1_ship.py b/Difficult_Rocket/client/render/sr1_ship.py index b3eb02c..d474857 100644 --- a/Difficult_Rocket/client/render/sr1_ship.py +++ b/Difficult_Rocket/client/render/sr1_ship.py @@ -210,16 +210,6 @@ class SR1ShipRender(BaseScreen): self.debug_d_pos_label.text = f'x: {self.camera_rs.dx} y: {self.camera_rs.dy}' self.debug_d_pos_label.position = self.camera_rs.dx + (self.window_pointer.width / 2), self.camera_rs.dy + ( self.window_pointer.height / 2) + 10, 0 - # if DR_option.use_DR_rust: - # # print(f'{self.dx=} {self.dy=} {self.scale=}') - # # from objprint import op - # # op(random.choices(self.parts_sprite), indent=1) - # return better_update_parts(self, SR1ShipRender_Option, self.window_pointer, - # self.rust_parts, 60) - # for part_id in self.part_data: - # # x y scale - # self.parts_sprite[part_id].x = self.part_data[part_id].x * 60 + self.window_pointer.width / 2 - # self.parts_sprite[part_id].y = self.part_data[part_id].y * 60 + self.window_pointer.height / 2 self.need_update_parts = False def on_draw(self): @@ -308,13 +298,18 @@ class SR1ShipRender(BaseScreen): 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 + from libs.pyglet.gl import GLubyte, GLint, GL_RGBA, GL_UNSIGNED_BYTE, \ + glReadPixels, glGetIntegerv + # from libs.pyglet.gl.gl_compat import GL_AUX_BUFFERS, GL_AUX0 + import pyglet width = window.width height = window.height format_str = "RGBA" + buffer_count = GLint(0) + # glGetIntegerv(GL_AUX_BUFFERS, buffer_count) + print(buffer_count) buf = (GLubyte * (len(format_str) * width * height))() glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf) # print(buf) diff --git a/configs/main.toml b/configs/main.toml index fe66987..9fa747f 100644 --- a/configs/main.toml +++ b/configs/main.toml @@ -8,8 +8,8 @@ fonts_folder = "libs/fonts" [window] style = "None" -width = 2123 -height = 1266 +width = 1358 +height = 739 visible = true gui_scale = 1 caption = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}" diff --git a/libs/Difficult_Rocket_rs/src/src/lib.rs b/libs/Difficult_Rocket_rs/src/src/lib.rs index 0d8f52c..0e1219b 100644 --- a/libs/Difficult_Rocket_rs/src/src/lib.rs +++ b/libs/Difficult_Rocket_rs/src/src/lib.rs @@ -8,6 +8,7 @@ mod sr1_render; mod render; +mod types; use pyo3::prelude::*; @@ -33,6 +34,5 @@ fn module_init(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_function(wrap_pyfunction!(sr1_render::better_update_parts, m)?)?; m.add_class::()?; m.add_class::()?; - // m.add_class::()?; Ok(()) } \ No newline at end of file diff --git a/libs/Difficult_Rocket_rs/src/src/render.rs b/libs/Difficult_Rocket_rs/src/src/render.rs index 42a5c47..686d442 100644 --- a/libs/Difficult_Rocket_rs/src/src/render.rs +++ b/libs/Difficult_Rocket_rs/src/src/render.rs @@ -126,46 +126,4 @@ pub mod camera { return Ok(()) } } - - // #[pymethods] - // impl CenterCameraRs { - // #[new] - // pub fn py_new() -> (Self, CameraRs) { - // (CenterCameraRs, CameraRs) - // } - // - // pub fn begin(self_: PyRef<'_, Self>) -> PyResult<()> { - // let super = self_.as_ref(); - // Python::with_gil(|py| -> PyResult<()> { - // // let x = self - // let view = super.window.getattr(py, intern!(py, "view"))?; - // - // let args = ((super.dx * super.zoom, super.dy * super.zoom, 0), ); - // let view_matrix = view.call_method1(py, intern!(py, "translate"), args)?; - // - // let args = ((super.zoom, super.zoom, 1), ); - // let view_matrix = view_matrix.call_method1(py, intern!(py, "scale"), args)?; - // - // super.window.setattr(py, intern!(py, "view"), view_matrix)?; - // Ok(()) - // })?; - // return Ok(()) - // } - - // pub fn end(&self) -> PyResult<()> { - // Python::with_gil(|py| -> PyResult<()> { - // let view = self.window.getattr(py, intern!(py, "view"))?; - // - // let args = ((1.0 / self.zoom, 1.0 / self.zoom, 1), ); - // let view_matrix = view.call_method1(py, intern!(py, "scale"), args)?; - // - // let args = ((-self.dx * self.zoom, -self.dy * self.zoom, 0), ); - // let view_matrix = view_matrix.call_method1(py, intern!(py, "translate"), args)?; - // - // self.window.setattr(py, intern!(py, "view"), view_matrix)?; - // Ok(()) - // })?; - // return Ok(()) - // } - // } } diff --git a/libs/Difficult_Rocket_rs/src/src/types.rs b/libs/Difficult_Rocket_rs/src/src/types.rs new file mode 100644 index 0000000..fed5cb8 --- /dev/null +++ b/libs/Difficult_Rocket_rs/src/src/types.rs @@ -0,0 +1,15 @@ +/* + * ------------------------------- + * Difficult Rocket + * Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com + * All rights reserved + * ------------------------------- + */ + + +pub mod sr1 { + pub mod data { + + } +} +