fyrox_impl/
lib.rs

1// Copyright (c) 2019-present Dmitry Stepanov and Fyrox Engine contributors.
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy
4// of this software and associated documentation files (the "Software"), to deal
5// in the Software without restriction, including without limitation the rights
6// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7// copies of the Software, and to permit persons to whom the Software is
8// furnished to do so, subject to the following conditions:
9//
10// The above copyright notice and this permission notice shall be included in all
11// copies or substantial portions of the Software.
12//
13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19// SOFTWARE.
20
21//! 3D/2D Game Engine.
22//!
23//! Tutorials can be found [here](https://fyrox-book.github.io/tutorials/tutorials.html)
24
25#![doc(
26    html_logo_url = "https://fyrox.rs/assets/logos/logo.png",
27    html_favicon_url = "https://fyrox.rs/assets/logos/logo.png"
28)]
29#![allow(clippy::too_many_arguments)]
30#![allow(clippy::upper_case_acronyms)]
31#![allow(clippy::from_over_into)]
32#![allow(clippy::approx_constant)]
33#![allow(clippy::doc_lazy_continuation)]
34#![allow(clippy::mutable_key_type)]
35
36pub mod engine;
37pub mod material;
38pub mod plugin;
39pub mod renderer;
40pub mod resource;
41pub mod scene;
42pub mod script;
43pub mod utils;
44
45pub use crate::core::rand;
46pub use fxhash;
47pub use lazy_static;
48pub use walkdir;
49pub use winit::*;
50
51#[doc(inline)]
52pub use fyrox_animation as generic_animation;
53
54#[doc(inline)]
55pub use fyrox_graph as graph;
56
57#[doc(inline)]
58pub use fyrox_core as core;
59
60#[doc(inline)]
61pub use fyrox_resource as asset;
62
63#[doc(inline)]
64pub use fyrox_ui as gui;
65
66/// Defines a builder's `with_xxx` method.
67#[macro_export]
68macro_rules! define_with {
69    ($(#[$attr:meta])* fn $name:ident($field:ident: $ty:ty)) => {
70        $(#[$attr])*
71        pub fn $name(mut self, value: $ty) -> Self {
72            self.$field = value;
73            self
74        }
75    };
76}
77
78#[cfg(test)]
79mod test {
80    use crate::scene::base::{Base, BaseBuilder};
81    use fyrox_core::reflect::Reflect;
82    use fyrox_core::ImmutableString;
83    use fyrox_sound::source::Status;
84    use fyrox_ui::widget::{Widget, WidgetBuilder};
85    use fyrox_ui::UserInterface;
86
87    #[test]
88    fn test_assembly_names() {
89        let mut ui = UserInterface::new(Default::default());
90        let var = ImmutableString::new("Foobar");
91        let base = BaseBuilder::new().build_base();
92        let widget = WidgetBuilder::new().build(&ui.build_ctx());
93        let status = Status::Stopped;
94
95        assert_eq!(var.assembly_name(), "fyrox-core");
96        assert_eq!(base.assembly_name(), "fyrox-impl");
97        assert_eq!(widget.assembly_name(), "fyrox-ui");
98        assert_eq!(status.assembly_name(), "fyrox-sound");
99
100        assert_eq!(ImmutableString::type_assembly_name(), "fyrox-core");
101        assert_eq!(Base::type_assembly_name(), "fyrox-impl");
102        assert_eq!(Widget::type_assembly_name(), "fyrox-ui");
103        assert_eq!(Status::type_assembly_name(), "fyrox-sound");
104    }
105}