Skip to main content

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 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#[doc(inline)]
67pub use fyrox_autotile as autotile;
68
69#[doc(inline)]
70pub use fyrox_graphics as graphics;
71
72#[doc(inline)]
73pub use fyrox_graphics_gl as graphics_gl;
74
75/// Defines a builder's `with_xxx` method.
76#[macro_export]
77macro_rules! define_with {
78    ($(#[$attr:meta])* fn $name:ident($field:ident: $ty:ty)) => {
79        $(#[$attr])*
80        pub fn $name(mut self, value: $ty) -> Self {
81            self.$field = value;
82            self
83        }
84    };
85}
86
87#[cfg(test)]
88mod test {
89    use crate::scene::base::{Base, BaseBuilder};
90    use fyrox_core::reflect::Reflect;
91    use fyrox_core::ImmutableString;
92    use fyrox_sound::source::Status;
93    use fyrox_ui::widget::{Widget, WidgetBuilder};
94    use fyrox_ui::UserInterface;
95
96    #[test]
97    fn test_assembly_names() {
98        let mut ui = UserInterface::new(Default::default());
99        let var = ImmutableString::new("Foobar");
100        let base = BaseBuilder::new().build_base();
101        let widget = WidgetBuilder::new().build(&ui.build_ctx());
102        let status = Status::Stopped;
103
104        assert_eq!(var.assembly_name(), "fyrox-core");
105        assert_eq!(base.assembly_name(), "fyrox-impl");
106        assert_eq!(widget.assembly_name(), "fyrox-ui");
107        assert_eq!(status.assembly_name(), "fyrox-sound");
108
109        assert_eq!(ImmutableString::type_assembly_name(), "fyrox-core");
110        assert_eq!(Base::type_assembly_name(), "fyrox-impl");
111        assert_eq!(Widget::type_assembly_name(), "fyrox-ui");
112        assert_eq!(Status::type_assembly_name(), "fyrox-sound");
113    }
114}