simluate!

This commit is contained in:
shenjack 2023-02-12 21:19:17 +08:00
parent 1e2b3a48fd
commit 73d7bb84e0
3 changed files with 8 additions and 1 deletions

View File

@ -19,6 +19,8 @@ if TYPE_CHECKING:
def get_version_str() -> str: ... def get_version_str() -> str: ...
def simluation() -> None: ...
class PartDatas: class PartDatas:
""" 用于在 PyObj 里塞一个浓眉大眼的 HashMap<uszie, SR1PartData>""" """ 用于在 PyObj 里塞一个浓眉大眼的 HashMap<uszie, SR1PartData>"""
def __new__(cls, py_part_data: Dict[int, SR1PartData]) -> "PartDatas": ... def __new__(cls, py_part_data: Dict[int, SR1PartData]) -> "PartDatas": ...

View File

@ -33,6 +33,7 @@ fn module_init(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_version_str, m)?)?; m.add_function(wrap_pyfunction!(get_version_str, m)?)?;
m.add_function(wrap_pyfunction!(test_call, m)?)?; m.add_function(wrap_pyfunction!(test_call, m)?)?;
m.add_function(wrap_pyfunction!(sr1_render::better_update_parts, m)?)?; m.add_function(wrap_pyfunction!(sr1_render::better_update_parts, m)?)?;
m.add_function(wrap_pyfunction!(simulator::simluation, m)?)?;
m.add_class::<sr1_render::types::PartDatas>()?; m.add_class::<sr1_render::types::PartDatas>()?;
m.add_class::<render::camera::CameraRs>()?; m.add_class::<render::camera::CameraRs>()?;
Ok(()) Ok(())

View File

@ -7,8 +7,11 @@
*/ */
use rapier2d::prelude::*; use rapier2d::prelude::*;
use pyo3::prelude::*;
fn main() { #[pyfunction]
#[pyo3(name = "simluation")]
pub fn simluation() -> PyResult<()> {
let mut rigid_body_set = RigidBodySet::new(); let mut rigid_body_set = RigidBodySet::new();
let mut collider_set = ColliderSet::new(); let mut collider_set = ColliderSet::new();
@ -61,4 +64,5 @@ fn main() {
ball_body.translation().y ball_body.translation().y
); );
} }
Ok(())
} }