Mercurial > touhou
comparison python/src/lib.rs @ 796:d876ac2ccfe1 default tip
Pass audio only once to GameRunner
This prevents it being recreated every stage change, and playing music over the
previous stages’ music.
| author | Link Mauve <linkmauve@linkmauve.fr> |
|---|---|
| date | Sun, 28 Jun 2026 14:27:03 +0200 |
| parents | 2d60a14f4816 |
| children |
comparison
equal
deleted
inserted
replaced
| 795:2d60a14f4816 | 796:d876ac2ccfe1 |
|---|---|
| 334 fn rand_double(&mut self) -> f64 { | 334 fn rand_double(&mut self) -> f64 { |
| 335 self.inner.get_f64() | 335 self.inner.get_f64() |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 #[pyclass(module = "libtouhou")] | |
| 340 pub struct DummyAudio; | |
| 341 | |
| 342 #[pymethods] | |
| 343 impl DummyAudio { | |
| 344 #[new] | |
| 345 fn new() -> DummyAudio { | |
| 346 DummyAudio | |
| 347 } | |
| 348 | |
| 349 fn load_bgms(&mut self, _bgms: [Option<(String, String)>; 4]) {} | |
| 350 | |
| 351 fn play_bgm(&mut self, _number: usize) {} | |
| 352 | |
| 353 fn play(&mut self, _name: &str) {} | |
| 354 } | |
| 355 | |
| 339 #[pymodule] | 356 #[pymodule] |
| 340 mod libtouhou { | 357 mod libtouhou { |
| 341 #[pymodule_export] | 358 #[pymodule_export] |
| 342 use super::Loader; | 359 use super::Loader; |
| 343 | 360 |
| 346 | 363 |
| 347 #[pymodule_export] | 364 #[pymodule_export] |
| 348 use super::Prng; | 365 use super::Prng; |
| 349 | 366 |
| 350 #[pymodule_export] | 367 #[pymodule_export] |
| 368 use crate::DummyAudio; | |
| 369 | |
| 370 #[pymodule_export] | |
| 351 use crate::audio::Audio; | 371 use crate::audio::Audio; |
| 352 | 372 |
| 353 #[cfg(feature = "glide")] | 373 #[cfg(feature = "glide")] |
| 354 #[pymodule_export] | 374 #[pymodule_export] |
| 355 use super::glide::module; | 375 use super::glide::module; |
