#![doc(html_logo_url = "https://dudochkin-victor.github.io/assets/ux-dx/logo.svg")]
#[macro_use]
extern crate bitflags;
pub mod ext;
pub mod app;
pub mod canvas;
pub mod core;
pub mod gles;
mod mimic;
pub use self::mimic::*;
pub mod resource;
pub mod scene;
pub mod time;
pub mod ui;
pub mod utils;
pub use wgpu_types::{
BlendFactor, CompareFunction, Face,
FrontFace,
ShaderLocation,
StencilOperation, TextureFormat,
TextureSampleType,
VertexFormat,
};
pub use primitives::{color, colorspace::Color};
pub mod prelude {
pub use crate::core::traits::*;
pub use primitives::prelude::*;
}
#[macro_export]
macro_rules! assets {
($path:tt) => {{
use std::{
env,
path::{Path, PathBuf},
};
let path = PathBuf::from($path);
if path.is_relative() {
if cfg!(debug_assertions) {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets")
.join(path)
} else {
match env::current_exe().unwrap().parent() {
Some(dir) => dir.join("assets").join(path),
None => {
path
}
}
}
} else {
path
}
}};
}
#[macro_export]
macro_rules! assets_source {
($path:tt) => {{
use std::{
borrow::Cow,
env,
fs::File,
io::prelude::*,
path::{Path, PathBuf},
};
let path = PathBuf::from($path);
let path = if path.is_relative() {
if cfg!(debug_assertions) {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets")
.join(path)
} else {
match env::current_exe().unwrap().parent() {
Some(dir) => dir.join("assets").join(path),
None => {
path
}
}
}
} else {
path
};
let mut buffer = Vec::new();
let mut file = File::open(path).expect("File open error");
file.read_to_end(&mut buffer).expect("File read error");
Cow::from(buffer)
}};
}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}