更新一下camera_rs的小细节

This commit is contained in:
shenjack 2023-02-07 00:01:25 +08:00
parent 242c2ca9a7
commit d104074549
5 changed files with 10 additions and 8 deletions

View File

@ -25,7 +25,7 @@ from libs.MCDR.version import Version
game_version = Version("0.7.0.0") # 游戏版本
build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关)
DR_rust_version = Version("0.1.7.0") # DR 的 Rust 编写部分的版本
DR_rust_version = Version("0.1.8.0") # DR 的 Rust 编写部分的版本
__version__ = game_version
long_version: int = 12

View File

@ -283,8 +283,8 @@ class SR1ShipRender(BaseScreen):
def on_mouse_drag(self, x: int, y: int, dx: int, dy: int, buttons: int, modifiers: int):
if not self.focus:
return
self.camera_rs.dx += dx
self.camera_rs.dy += dy
self.camera_rs.dx += dx / self.camera_rs.zoom
self.camera_rs.dy += dy / self.camera_rs.zoom
self.need_update_parts = True
# self.update_parts()

View File

@ -1,6 +1,8 @@
Set-Location .\libs\Difficult_Rocket_rs\src
python3.8 setup.py build
python3.9 setup.py build
python3.11 setup.py build
python3.8 after_build.py

View File

@ -13,7 +13,7 @@ use pyo3::prelude::*;
#[pyfunction]
fn get_version_str() -> String {
return String::from("0.1.7.0");
return String::from("0.1.8.0");
}
#[pyfunction]

View File

@ -72,8 +72,8 @@ pub mod camera {
let x: f64 = self.window.getattr(py, intern!(py, "width"))?.extract(py)?;
let y: f64 = self.window.getattr(py, intern!(py, "height"))?.extract(py)?;
let x: f64 = x / 2.0 / self.zoom + (self.dx / self.zoom);
let y: f64 = y / 2.0 / self.zoom + (self.dy / self.zoom);
let x: f64 = x / 2.0 / self.zoom + self.dx;
let y: f64 = y / 2.0 / self.zoom + self.dy;
let args = ((x * self.zoom, y * self.zoom, 0), );
let view_matrix = view.call_method1(py, intern!(py, "translate"), args)?;
@ -93,8 +93,8 @@ pub mod camera {
let x: f64 = self.window.getattr(py, intern!(py, "width"))?.extract(py)?;
let y: f64 = self.window.getattr(py, intern!(py, "height"))?.extract(py)?;
let x: f64 = x / 2.0 / self.zoom + (self.dx / self.zoom);
let y: f64 = y / 2.0 / self.zoom + (self.dy / self.zoom);
let x: f64 = x / 2.0 / self.zoom + self.dx;
let y: f64 = y / 2.0 / self.zoom + self.dy;
let args = ((1.0 / self.zoom, 1.0 / self.zoom, 1), );
let view_matrix = view.call_method1(py, intern!(py, "scale"), args)?;