crayon/
lib.rs

1//! # What is This?
2//! Crayon is a small, portable and extensible game framework, which loosely inspired by some
3//! amazing blogs on [bitsquid](https://bitsquid.blogspot.de), [molecular](https://blog.molecular-matters.com)
4//! and [floooh](http://floooh.github.io/).
5//!
6//! Some goals include:
7//!
8//! - Extensible through external code modules;
9//! - Run on macOS, Linux, Windows, iOS, Android from the same source;
10//! - Built from the ground up to focus on multi-thread friendly with a work-stealing job scheduler;
11//! - Stateless, layered, multithread render system with OpenGL(ES) 3.0 backends;
12//! - Simplified assets workflow and asynchronous data loading from various filesystem;
13//! - Unified interfaces for handling input devices across platforms;
14//! - etc.
15//!
16//! This project adheres to [Semantic Versioning](http://semver.org/), all notable changes will be documented in this [file](./CHANGELOG.md).
17//!
18//! ### Quick Example
19//! For the sake of brevity, you can als run a simple and quick example with commands:
20//!
21//! ``` sh
22//! git clone git@github.com:shawnscode/crayon.git
23//! cargo run --example modules_3d_prefab
24//! ```
25
26#![allow(clippy::new_ret_no_self)]
27
28#[cfg(not(target_arch = "wasm32"))]
29extern crate gl;
30#[cfg(not(target_arch = "wasm32"))]
31extern crate glutin;
32
33#[cfg(target_arch = "wasm32")]
34extern crate console_error_panic_hook;
35#[cfg(target_arch = "wasm32")]
36extern crate js_sys;
37#[cfg(target_arch = "wasm32")]
38extern crate wasm_bindgen;
39#[cfg(target_arch = "wasm32")]
40extern crate web_sys;
41
42#[macro_use]
43extern crate failure;
44#[macro_use]
45extern crate log;
46
47#[macro_use]
48extern crate cgmath;
49#[macro_use]
50extern crate serde;
51extern crate byteorder;
52extern crate serde_json;
53
54extern crate crossbeam_deque;
55extern crate inlinable_string;
56extern crate smallvec;
57
58pub extern crate bincode;
59pub extern crate uuid;
60
61pub use cgmath::{assert_relative_eq, assert_relative_ne, assert_ulps_eq, assert_ulps_ne};
62pub use cgmath::{relative_eq, relative_ne, ulps_eq, ulps_ne};
63pub use log::{error, info, warn};
64
65pub mod errors;
66#[macro_use]
67pub mod utils;
68pub mod application;
69#[macro_use]
70pub mod video;
71pub mod input;
72pub mod math;
73pub mod prelude;
74pub mod res;
75pub mod sched;
76pub mod window;
77
78#[macro_export]
79macro_rules! main {
80    ($codes: block) => {
81        #[cfg(target_arch = "wasm32")]
82        extern crate wasm_bindgen;
83        #[cfg(target_arch = "wasm32")]
84        use wasm_bindgen::prelude::wasm_bindgen;
85
86        #[cfg(target_arch = "wasm32")]
87        #[wasm_bindgen(start)]
88        pub fn run() {
89            $codes
90        }
91
92        fn main() {
93            #[cfg(not(target_arch = "wasm32"))]
94            $codes
95        }
96    };
97}