Impl default for create info

This commit is contained in:
hodasemi 2023-01-21 14:40:58 +01:00
parent febcfbc0b4
commit d0b7b7dd24

View file

@ -28,7 +28,13 @@ pub enum Font<'a> {
Bytes(&'a [u8]),
}
#[derive(Deserialize, Serialize, Clone, Debug)]
impl Default for Font<'_> {
fn default() -> Self {
Self::Path(AssetPath::default())
}
}
#[derive(Deserialize, Serialize, Clone, Debug, Default)]
pub struct GuiHandlerCreateInfo<'a> {
// default button textures
pub menu_button: AssetPath,
@ -49,23 +55,23 @@ pub struct GuiHandlerCreateInfo<'a> {
}
impl<'a> GuiHandlerCreateInfo<'a> {
pub const fn default() -> Self {
pub const fn new() -> Self {
GuiHandlerCreateInfo {
// default button textures
menu_button: AssetPath::default(),
menu_button_selected: AssetPath::default(),
menu_button: AssetPath::new(),
menu_button_selected: AssetPath::new(),
// path to the alphabet image
font: Font::Path(AssetPath::default()),
font: Font::Path(AssetPath::new()),
// sound info
#[cfg(feature = "audio")]
click_sound: AssetPath::default(),
click_sound: AssetPath::new(),
#[cfg(feature = "audio")]
hover_sound: AssetPath::default(),
hover_sound: AssetPath::new(),
// resource base directory
resource_directory: AssetPath::default(),
resource_directory: AssetPath::new(),
}
}
}