Fix: 修复了渲染偏移的问题
以及吃了四串牛肉串
This commit is contained in:
parent
d104074549
commit
aa2341a806
@ -155,8 +155,8 @@ class SR1ShipRender(BaseScreen):
|
||||
# render_scale = DR_option.gui_scale # 这个是 DR 的缩放比例 可以调节的(
|
||||
# 主要是 Windows 下有一个缩放系数嘛,我待会试试这玩意能不能获取(估计得 ctypes
|
||||
# 在不缩放的情况下,XML的1个单位长度对应60个像素
|
||||
render_x = part.x * 60 + self.window_pointer.width / 2
|
||||
render_y = part.y * 60 + self.window_pointer.height / 2
|
||||
render_x = part.x * 60
|
||||
render_y = part.y * 60
|
||||
# 你就这里改吧
|
||||
cache_sprite = Sprite(img=self.textures.get_texture(part.textures),
|
||||
x=render_x, y=render_y,
|
||||
|
@ -74,14 +74,18 @@ pub mod camera {
|
||||
let y: f64 = self.window.getattr(py, intern!(py, "height"))?.extract(py)?;
|
||||
let x: f64 = x / 2.0 / self.zoom + self.dx;
|
||||
let y: f64 = y / 2.0 / self.zoom + self.dy;
|
||||
// use to get center of the screen
|
||||
|
||||
let args = ((x * self.zoom, y * self.zoom, 0), );
|
||||
let view_matrix = view.call_method1(py, intern!(py, "translate"), args)?;
|
||||
// view_matrix = self.view.translate((x * zoom, y * zoom, 0))
|
||||
|
||||
let args = ((self.zoom, self.zoom, 1), );
|
||||
let view_matrix = view_matrix.call_method1(py, intern!(py, "scale"), args)?;
|
||||
// view_matrix = view_matrix.scale((zoom, zoom, 1))
|
||||
|
||||
self.window.setattr(py, intern!(py, "view"), view_matrix)?;
|
||||
// self.view = view_matrix
|
||||
Ok(())
|
||||
})?;
|
||||
return Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user