Skip to main content

pfx_play/
lib.rs

1pub mod characters;
2mod events;
3mod game;
4mod hooks;
5mod layers;
6mod live;
7mod math;
8mod paint;
9mod present;
10pub mod rigs;
11mod session;
12mod settings;
13pub mod tunables;
14mod ui;
15mod world;
16
17#[cfg(test)]
18mod tests;
19
20pub use events::{Phase, TriggerEvent, WorldEvent};
21pub use game::{FrameTime, Game, GameError, SceneGame};
22pub use hooks::{NoHooks, PlayHooks};
23pub use layers::Layers;
24pub use live::{Edit, Pending, Stamped};
25pub use paint::{NoWarmer, PaintFrame, Warm, Warmer, Warming};
26pub use pfx_core::modules::{Level, Notice, Reload};
27pub use present::PlayFrame;
28pub use rigs::{RigDesc, Rigs};
29pub use session::{MOTORS_KEPT, Options, PlaySession, Stopped};
30pub use settings::{Audio, Cap, Pacing, Settings};
31pub use tunables::{Kind, Tunable, TunableValue, Tunables};
32pub use ui::{Anchor, Label, Prompt, PromptOf, Ui, UiFrame, UiLook};
33pub use world::{
34    Animate, AnimationEvent, Contact, Cursor, Exit, Fx, Hit, Look, ObjectId, Overlap, PcmStream,
35    Query, QueryError, RumbleRequest, SoundLevel, Sounds, World, body_volume,
36};
37
38#[derive(Clone, Debug, PartialEq)]
39pub enum PlayError {
40    Clock(String),
41    Actions(pfx_input::ActionsError),
42    Sound(String),
43    Body(String),
44    Render(String),
45    Tunables(String),
46    Rigs(String),
47    Layers(String),
48    Animation(String),
49}
50
51impl std::fmt::Display for PlayError {
52    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53        match self {
54            Self::Clock(message) => write!(f, "play clock: {message}"),
55            Self::Actions(error) => write!(f, "play input actions: {error:?}"),
56            Self::Sound(message)
57            | Self::Body(message)
58            | Self::Render(message)
59            | Self::Tunables(message)
60            | Self::Rigs(message)
61            | Self::Layers(message)
62            | Self::Animation(message) => f.write_str(message),
63        }
64    }
65}
66
67impl std::error::Error for PlayError {}