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] [window]
style = "None" style = "None"
width = 1021 width = 2175
height = 1078 height = 1808
visible = true visible = true
gui_scale = 1 gui_scale = 1
caption = "Difficult Rocket v{DR_version}" caption = "Difficult Rocket v{DR_version}"

View File

@ -3,7 +3,15 @@
- 最新版本号 - 最新版本号
- DR game: 0.2.0.0 - 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 ## DR game 0.2.0.0

View File

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

View File

@ -26,7 +26,7 @@ enum LoadState {
} }
#[pyfunction] #[pyfunction]
fn get_version_str() -> String { "0.2.10.1".to_string() } fn get_version_str() -> String { "0.2.11.0".to_string() }
#[pyfunction] #[pyfunction]
fn test_call(py_obj: &PyAny) -> PyResult<bool> { 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.client import ClientWindow
from Difficult_Rocket.api.types import Options, Version 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') 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 cache_sprite.y = cache_sprite.y - cache_sprite.scale_y / 2
self.parts_sprite[part.id] = cache_sprite self.parts_sprite[part.id] = cache_sprite
part_width = 100
part_height = 100
if DR_mod_runtime.use_DR_rust: 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) part_debug_box = self.rust_ship.get_part_box(part.id)
if part_type is not None: if part_debug_box:
part_width = part_type.width * 15 # 线框
part_height = part_type.height * 15 part_line_box = []
# 白色框框 width = 3
part_box = Rectangle(x=render_x, y=render_y, color = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255))
width=part_width, height=part_height, part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[0][1] * 30,
batch=self.part_box_batch, group=self.part_group) x2=part_debug_box[0][0] * 30, y2=part_debug_box[1][1] * 30,
part_box.rotation = SR1Rotation.get_rotation(part.angle) batch=self.part_box_batch, width=width, color=color))
part_box.opacity = 50 part_line_box.append(Line(x=part_debug_box[0][0] * 30, y=part_debug_box[1][1] * 30,
self.part_box_dict[part.id] = part_box 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 = [] part_line_box.append(Line(x=part_debug_box[1][0] * 30, y=part_debug_box[1][1] * 30,
width = 3 x2=part_debug_box[1][0] * 30, y2=part_debug_box[0][1] * 30,
color = (random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255)) 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[0][1] * 30, 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[1][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)) 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, self.part_line_box[part.id] = part_line_box
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: # 如果不渲染(渲染有毛病) # if not part_render: # 如果不渲染(渲染有毛病)
# self.parts_sprite[part.id].visible = False # self.parts_sprite[part.id].visible = False
count += 1 count += 1