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:
|
|
|
|
/// ```
|
2019-08-06 06:31:48 +00:00
|
|
|
/// font_ids! {
|
|
|
|
/// pub struct Fonts {
|
|
|
|
/// font1: "filename1",
|
|
|
|
/// font2: "filename2",
|
2019-04-30 20:43:55 +00:00
|
|
|
/// }
|
|
|
|
/// }
|
|
|
|
/// ```
|
|
|
|
#[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)?), )*
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)*
|
|
|
|
};
|
|
|
|
}
|