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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! # Lux

#![warn(missing_docs)]

#[macro_use]
extern crate glium;

extern crate glutin;
extern crate vecmath;
extern crate image;
extern crate num;
extern crate clock_ticks;
extern crate font_atlas;
#[cfg(feature="freetype")]
extern crate font_atlas_freetype as freetype_atlas;
extern crate font_atlas_image as image_atlas;
extern crate poison_pool;

mod private;

pub use private::types;

pub use private::error::{LuxError, LuxResult};

pub mod color {
    //! Color creation functions and some named defaults.

    pub use private::color::{Color, rgb, rgba, hsv, hsva, hex_rgb, hex_rgba};
    pub use private::colors::*;
}

pub mod graphics {
    //! All of 2d graphics related functionality.
    //!
    //! Most of the methods that actually let you draw things are defined in two main traits:
    //! `Canvas` and `PrimitiveCanvas`.
    //!
    //! The two objects that can be drawn to are are `Frame` and
    //! `DrawableTexture`.

    pub use private::canvas::{Canvas, Rectangle, Ellipse, ContainedSprite};
    pub use private::gfx_integration::{ColorVertex, TexVertex};
    pub use private::primitive_canvas::{PrimitiveCanvas, StencilType};
    pub use private::sprite::{
        IntoSprite,
        Sprite,
        Texture,
        DrawableTexture,
        UniformSpriteSheet,
        NonUniformSpriteSheet,
        TextureLoader
    };
    pub use glium::index::PrimitiveType;
    pub use glium::index::PrimitiveType::*;
}

pub mod interactive {
    //! Functionality for dealing with events, querying, and  modifying
    //! the window.

    pub use private::interactive::{
        keycodes,
        EventIterator,
        Event,
        MouseButton,
        Interactive,
        AbstractKey
    };
}

pub mod window {
    //! The main window and the frames that are generated by the window.
    //!
    //! The window is created by the Glutin library.

    pub use private::glutin_window::{Window, Frame};
}

pub mod modifiers {
    //! Many contexts can be modified and chained together in a logical way.

    pub use private::raw::{Colored, Transform};
}

pub mod game {
    //! A game loop implementation using Lux for windowing and graphics.
    //!
    //! While the majority of the Lux API is mostly agnostic to the way that
    //! you structure your app, this module contains structure and a game loop
    //! implementation

    pub use private::game::{Game, GameRunner};
}

pub mod font {
    //! Text drawing and loading functionality.
    //!
    //! # WARNING
    //! The `render` function and the `SOURCE_CODE_PRO_REGULAR` static variable
    //! is only available when lux is compiled with the `freetype` cargo feature enabled.

    pub use private::font::{ContainedText, TextDraw, TextLoad};

    pub use image_atlas::{load_atlas, read_atlas, save_atlas, write_atlas};

    #[cfg(feature="freetype")]
    pub use freetype_atlas::{render};
    #[cfg(feature="freetype")]
    pub use private::constants::SOURCE_CODE_PRO_REGULAR;
}

pub mod prelude {
    //! A collection of common traits, structs and functions that are
    //! recommended for average Lux usage.

    pub use color::{Color, rgb, rgba, hsv, hsva};
    pub use graphics::{Canvas, IntoSprite};
    pub use interactive::Interactive;
    pub use window::{Window, Frame};
    pub use interactive::EventIterator;
    pub use modifiers::{Colored, Transform};
    pub use font::{TextDraw};
    pub use graphics::TextureLoader;

    pub use LuxError;
    pub use LuxResult;
}