1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
// "adi_screen" - Aldaron's Device Interface / Screen // // Copyright Jeron A. Lau 2017 - 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) pub use adi_gpu::*; /// Macro to create multiple sprites in an array. /// /// # Example /// ``` /// let mut window = WindowBuilder::new("Window Name", None).finish(); /// /// textures!(window, aci_png::decode, /// "res/texture0.png", // 0 /// "res/texture1.png", // 1 /// ); /// /// models!(window, "res/model.data"); /// /// let sprites = sprites!(window, /// (0/*model 0*/, Some(0/*texture 0*/), /// Transform::new().translate(0.0, -0.5, 2.0), false), /// (0/*model 0*/, Some(0/*texture 0*/), /// Transform::new().translate(0.0, -4.5, 2.0), false)); /// ``` #[macro_export] macro_rules! sprites { ($window:expr, $( $x:expr ),*) => { { let window = $window; [ $( $crate::Sprite::new(window, $x.0, $x.1, $x.2, $x.3, false, true) ),* ] } } } /// Macro to create multiple fog-affected sprites in an array. /// # Example /// See [`sprites!()`](macro.sprites.html) #[macro_export] macro_rules! sprites_fog { ($window:expr, $( $x:expr ),*) => { { let window = $window; [ $( $crate::Sprite::new(window, $x.0, $x.1, $x.2, $x.3, true, true) ),* ] } } } /// Macro to create multiple non-camera affected sprites in an array. /// # Example /// See [`sprites!()`](macro.sprites.html) #[macro_export] macro_rules! sprites_gui { ($window:expr, $( $x:expr ),*) => { { let window = $window; [ $( $crate::Sprite::new(window, $x.0, $x.1, $x.2, $x.3, false, false) ),* ] } } } /// Macro to load textures from files for the window. /// /// The first texture file listed is indexed 0, and each subsequent texture /// increases by 1. See: [`sprites!()`](macro.sprites.html) for example. #[macro_export] macro_rules! textures { ($window:expr, $decode:expr, $( $x:expr ),*) => { { let a = vec![ $( $crate::Texture::new($window, $decode(include_bytes!($x)).unwrap()) ),* ]; $window.textures(a); } } }