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#![allow(mismatched_lifetime_syntaxes)]
36
37pub mod engine;
38pub mod material;
39pub mod plugin;
40pub mod renderer;
41pub mod resource;
42pub mod scene;
43pub mod script;
44pub mod utils;
45
46pub use crate::core::rand;
47pub use fxhash;
48pub use lazy_static;
49pub use walkdir;
50pub use winit::*;
51
52#[doc(inline)]
53pub use fyrox_animation as generic_animation;
54
55#[doc(inline)]
56pub use fyrox_graph as graph;
57
58#[doc(inline)]
59pub use fyrox_core as core;
60
61#[doc(inline)]
62pub use fyrox_resource as asset;
63
64#[doc(inline)]
65pub use fyrox_ui as gui;
66
67#[doc(inline)]
68pub use fyrox_autotile as autotile;
69
70#[doc(inline)]
71pub use fyrox_graphics as graphics;
72
73#[doc(inline)]
74pub use fyrox_graphics_gl as graphics_gl;
75
76/// Defines a builder's `with_xxx` method.
77#[macro_export]
78macro_rules! define_with {
79    ($(#[$attr:meta])* fn $name:ident($field:ident: $ty:ty)) => {
80        $(#[$attr])*
81        pub fn $name(mut self, value: $ty) -> Self {
82            self.$field = value;
83            self
84        }
85    };
86}
87
88#[cfg(test)]
89mod test {
90    use crate::scene::base::{Base, BaseBuilder};
91    use fyrox_core::reflect::Reflect;
92    use fyrox_core::ImmutableString;
93    use fyrox_sound::source::Status;
94    use fyrox_ui::widget::{Widget, WidgetBuilder};
95    use fyrox_ui::UserInterface;
96
97    #[test]
98    fn test_assembly_names() {
99        let mut ui = UserInterface::new(Default::default());
100        let var = ImmutableString::new("Foobar");
101        let base = BaseBuilder::new().build_base();
102        let widget = WidgetBuilder::new().build(&ui.build_ctx());
103        let status = Status::Stopped;
104
105        assert_eq!(var.assembly_name(), "fyrox-core");
106        assert_eq!(base.assembly_name(), "fyrox-impl");
107        assert_eq!(widget.assembly_name(), "fyrox-ui");
108        assert_eq!(status.assembly_name(), "fyrox-sound");
109
110        assert_eq!(ImmutableString::type_assembly_name(), "fyrox-core");
111        assert_eq!(Base::type_assembly_name(), "fyrox-impl");
112        assert_eq!(Widget::type_assembly_name(), "fyrox-ui");
113        assert_eq!(Status::type_assembly_name(), "fyrox-sound");
114    }
115}