From 768e2d50fdbf8a2de8b57e7363cf26d95dbdc015 Mon Sep 17 00:00:00 2001 From: "1992414357@qq.com" <1992414357@qq.com> Date: Wed, 18 Jun 2025 02:52:12 +0800 Subject: Finished CBindings --- core/src/data/controller/controller_data.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'core/src/data/controller/controller_data.rs') diff --git a/core/src/data/controller/controller_data.rs b/core/src/data/controller/controller_data.rs index a3f1c02..a40f49c 100644 --- a/core/src/data/controller/controller_data.rs +++ b/core/src/data/controller/controller_data.rs @@ -4,7 +4,7 @@ use crate::data::player::player_data::Player; /// Controller-side Data /// Describes the basic information of the controller side -#[derive(Default)] +#[derive(Default, Clone)] pub struct ControllerData { /// Player bound to the controller side @@ -26,4 +26,13 @@ impl ControllerData { }; Arc::new(Mutex::new(runtime)) } + + /// Build the controller-side runtime using controller data (borrowed) + pub fn runtime_with_borrowed_data(&self) -> Arc> { + let runtime = ControllerRuntime { + player: self.player.clone(), + ..Default::default() + }; + Arc::new(Mutex::new(runtime)) + } } \ No newline at end of file -- cgit