| 13 | #[godot_api] |
| 14 | impl ISprite2D for Player { |
| 15 | fn init(base: Base<Sprite2D>) -> Self { |
| 16 | match EXAMPLE_SINGLETON.lock() { |
| 17 | Err(e) => godot_error!("{:?}", e), |
| 18 | Ok(mut s) => { |
| 19 | s.add("EXAMPLE_SINGLETON: Not a registered Godot Singleton".to_string()); |
| 20 | s.print(); |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | match Engine::singleton().get_singleton("MyGodotSingleton") { |
| 25 | None => godot_error!("Failed to get singleton"), |
| 26 | Some(s) => s.try_cast::<MyGodotSingleton>().unwrap().bind().print(), |
| 27 | }; |
| 28 | |
| 29 | Self { base } |
| 30 | } |
| 31 | |
| 32 | fn physics_process(&mut self, delta: f64) { |
| 33 | let radians = (3.14 * delta) as f32; |