2019-04-30 20:43:55 +00:00
|
|
|
/// This macro will automatically load all specified assets, get the corresponding FontIds and
|
2019-05-17 09:22:32 +00:00
|
|
|
/// create a struct with all of them.
|
2019-04-30 20:43:55 +00:00
|
|
|
///
|
|
|
|
/// Example usage:
|
|
|
|
/// ```
|
|
|
|
/// image_ids! {
|
|
|
|
/// pub struct Imgs {
|
|
|
|
/// font1: "filename1.vox",
|
|
|
|
/// font2: "filename2.vox",
|
|
|
|
/// }
|
|
|
|
/// }
|
|
|
|
/// ```
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! font_ids {
|
|
|
|
($($v:vis struct $Ids:ident { $( $name:ident: $specifier:expr $(,)? )* })*) => {
|
|
|
|
$(
|
|
|
|
$v struct $Ids {
|
|
|
|
$( $v $name: conrod_core::text::font::Id, )*
|
|
|
|
}
|
|
|
|
|
|
|
|
impl $Ids {
|
|
|
|
pub fn load(ui: &mut crate::ui::Ui) -> Result<Self, common::assets::Error> {
|
|
|
|
Ok(Self {
|
|
|
|
$( $name: ui.new_font(common::assets::load($specifier)?), )*
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)*
|
|
|
|
};
|
|
|
|
}
|