first part for phy simluation #34

Merged
shenjackyuanjie merged 19 commits from dr_game/phy_simluation into main 2023-06-22 02:11:47 +08:00
6 changed files with 32 additions and 37 deletions
Showing only changes of commit 22995a01af - Show all commits

View File

@ -7,8 +7,8 @@ fonts_folder = "libs/fonts"
[window]
style = "None"
width = 1021
height = 1078
width = 2175
height = 1808
visible = true
gui_scale = 1
caption = "Difficult Rocket v{DR_version}"

View File

@ -3,7 +3,15 @@
- 最新版本号
- DR game: 0.2.0.0
- DR rs: 0.2.10.1
- DR rs: 0.2.11.0
## DR rs 0.2.11.0
### 添加
- `Python::data::PySR1Ship`
- `get_part_box(&self, part_id: i64) -> Option<(f64, f64), (f64, f64)>`
- 用于获取对应 id 的碰撞箱
## DR game 0.2.0.0

View File

@ -12,7 +12,7 @@ package_path = 'Difficult_Rocket_rs'
setup(
name='Difficult_Rocket_rs',
version="0.2.10.1",
version="0.2.11.0",
author='shenjackyuanjie',
author_email='3695888@qq.com',
rust_extensions=[RustExtension(target="Difficult_Rocket_rs.Difficult_Rocket_rs",

View File

@ -26,7 +26,7 @@ enum LoadState {
}
#[pyfunction]
fn get_version_str() -> String { "0.2.10.1".to_string() }
fn get_version_str() -> String { "0.2.11.0".to_string() }
#[pyfunction]
fn test_call(py_obj: &PyAny) -> PyResult<bool> {

View File

@ -17,7 +17,7 @@ from Difficult_Rocket.api.mod import ModInfo
from Difficult_Rocket.client import ClientWindow
from Difficult_Rocket.api.types import Options, Version
DR_rust_version = Version("0.2.10.1") # DR_mod 的 Rust 编写部分的兼容版本
DR_rust_version = Version("0.2.11.0") # DR_mod 的 Rust 编写部分的兼容版本
logger = logging.getLogger('client.dr_game')

View File

@ -192,39 +192,26 @@ class SR1ShipRender(BaseScreen):
cache_sprite.y = cache_sprite.y - cache_sprite.scale_y / 2
self.parts_sprite[part.id] = cache_sprite
part_width = 100
part_height = 100
if DR_mod_runtime.use_DR_rust:
part_type = self.part_list_rs.get_part_type(part.p_type)
part_debug_box = self.rust_ship.get_part_box(part.id)
if part_type is not None:
part_width = part_type.width * 15
part_height = part_type.height * 15
# 白色框框
part_box = Rectangle(x=render_x, y=render_y,
width=part_width, height=part_height,
batch=self.part_box_batch, group=self.part_group)
part_box.rotation = SR1Rotation.get_rotation(part.angle)
part_box.opacity = 50
self.part_box_dict[part.id] = part_box
# 线框
part_line_box = []
width = 3
color = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255))
part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[0][1] * 30,
x2=part_debug_box[0][0] * 30, y2=part_debug_box[1][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[1][1] * 30,
x2=part_debug_box[1][0] * 30, y2=part_debug_box[1][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[1][0] * 30, y=part_debug_box[1][1] * 30,
x2=part_debug_box[1][0] * 30, y2=part_debug_box[0][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[1][0] * 30, y=part_debug_box[0][1] * 30,
x2=part_debug_box[0][0] * 30, y2=part_debug_box[0][1] * 30,
batch=self.part_box_batch, width=width, color=color))
self.part_line_box[part.id] = part_line_box
if part_debug_box:
# 线框
part_line_box = []
width = 3
color = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255))
part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[0][1] * 30,
x2=part_debug_box[0][0] * 30, y2=part_debug_box[1][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[1][1] * 30,
x2=part_debug_box[1][0] * 30, y2=part_debug_box[1][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[1][0] * 30, y=part_debug_box[1][1] * 30,
x2=part_debug_box[1][0] * 30, y2=part_debug_box[0][1] * 30,
batch=self.part_box_batch, width=width, color=color))
part_line_box.append(Line(x=part_debug_box[1][0] * 30, y=part_debug_box[0][1] * 30,
x2=part_debug_box[0][0] * 30, y2=part_debug_box[0][1] * 30,
batch=self.part_box_batch, width=width, color=color))
self.part_line_box[part.id] = part_line_box
# if not part_render: # 如果不渲染(渲染有毛病)
# self.parts_sprite[part.id].visible = False
count += 1