1
1
//! Rendering and math related types.
2

            
3
#![forbid(unsafe_code)]
4
#![warn(
5
    clippy::cargo,
6
    missing_docs,
7
    // clippy::missing_docs_in_private_items,
8
    clippy::pedantic,
9
    future_incompatible,
10
    rust_2018_idioms,
11
)]
12
#![cfg_attr(doc, deny(rustdoc::all))]
13
#![allow(
14
    clippy::missing_errors_doc, // TODO clippy::missing_errors_doc
15
    clippy::missing_panics_doc, // TODO clippy::missing_panics_doc
16
    clippy::option_if_let_else,
17
    clippy::module_name_repetitions,
18
    clippy::cast_possible_truncation,
19
    clippy::cast_precision_loss,
20
    clippy::mut_mut, // false alarm on futures::select!
21
)]
22

            
23
mod color;
24
mod delay;
25
mod error;
26
/// Renders individual frames. Can be used for offscreen rendering.
27
pub mod frame_renderer;
28
/// Math types for 2d geometry.
29
pub mod math;
30
/// `Scene` and `Target` types that are used to draw.
31
pub mod scene;
32
/// Types for rendering shapes.
33
pub mod shape;
34
/// Types for rendering sprites.
35
pub mod sprite;
36
#[cfg(test)]
37
mod tests;
38
/// Types for rendering text.
39
pub mod text;
40
/// Types for managing textures.
41
pub mod texture;
42

            
43
// Re-exports
44
pub use {easygpu, figures, flume, image, lazy_static, winit};
45

            
46
pub use self::color::Color;
47
pub use self::error::Error;
48
pub use self::frame_renderer::{FrameRenderer, ShutdownCallback};
49

            
50
/// A collection of commonly used exports provided by this crate.
51
pub mod prelude {
52
    pub use figures::{
53
        Approx as _, Ceil as _, Displayable as _, Floor as _, One as _, Rectlike as _, Round as _,
54
        Vectorlike as _, Zero as _,
55
    };
56

            
57
    pub use super::math::{
58
        Angle, Figure, Pixels, Point, Rect, Scale, Scaled, Size, Unknown, Vector,
59
    };
60
    pub use super::scene::{Scene, Target};
61
    pub use super::shape::*;
62
    pub use super::sprite::{
63
        AnimationMode, Sprite, SpriteAnimation, SpriteAnimations, SpriteCollection, SpriteFrame,
64
        SpriteMap, SpriteRotation, SpriteSheet, SpriteSource, SpriteSourceSublocation,
65
    };
66
    #[cfg(feature = "bundled-fonts-enabled")]
67
    pub use super::text::bundled_fonts;
68
    pub use super::text::font::Font;
69
    pub use super::text::prepared::PreparedSpan;
70
    pub use super::text::Text;
71
    pub use super::texture::Texture;
72
    pub use super::{
73
        include_aseprite_sprite, include_font, include_texture, Color, FrameRenderer,
74
        ShutdownCallback,
75
    };
76
}
77

            
78
/// Alias for [`std::result::Result`] where the error type is [`Error`].
79
pub type Result<T> = std::result::Result<T, Error>;