Compare commits
1 commit
b4c8407df3
...
e90ae8e1cb
Author | SHA1 | Date | |
---|---|---|---|
e90ae8e1cb |
1 changed files with 8 additions and 12 deletions
|
@ -1,8 +1,7 @@
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
|
|
||||||
use crate::gui_handler::gui_handler::GuiHandler;
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ecs::Commands;
|
use ecs::World;
|
||||||
|
|
||||||
use super::ControllerButton;
|
use super::ControllerButton;
|
||||||
|
|
||||||
|
@ -28,12 +27,12 @@ macro_rules! callbacks {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
callbacks!(ClickCallbacks, Fn(&mut Commands, &mut GuiHandler) -> Result<()> + Send + Sync);
|
callbacks!(ClickCallbacks, Fn(&mut World) -> Result<()> + Send + Sync);
|
||||||
callbacks!(SelectCallbacks, Fn(&mut Commands, &mut GuiHandler, bool) -> anyhow::Result<()> + Send + Sync);
|
callbacks!(SelectCallbacks, Fn(&mut World, bool) -> anyhow::Result<()> + Send + Sync);
|
||||||
callbacks!(CustomCallbacks, Fn(&mut Commands, &mut GuiHandler, ControllerButton) -> anyhow::Result<bool> + Send + Sync);
|
callbacks!(CustomCallbacks, Fn(&mut World, ControllerButton) -> anyhow::Result<bool> + Send + Sync);
|
||||||
callbacks!(
|
callbacks!(
|
||||||
VecCallbacks,
|
VecCallbacks,
|
||||||
Fn(&mut Commands, &mut GuiHandler, &dyn Any) -> Result<()> + Send + Sync
|
Fn(&mut World, &dyn Any) -> Result<()> + Send + Sync
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -41,8 +40,8 @@ mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
fn normal_fn() -> impl Fn(&mut Commands, &mut GuiHandler) -> Result<()> + Send + Sync {
|
fn normal_fn() -> impl Fn(&mut World) -> Result<()> + Send + Sync {
|
||||||
|_, _| Ok(())
|
|_| Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -52,10 +51,7 @@ mod test {
|
||||||
impl Test {
|
impl Test {
|
||||||
fn set_click_callbacks(
|
fn set_click_callbacks(
|
||||||
&self,
|
&self,
|
||||||
_callbacks: Vec<(
|
_callbacks: Vec<(&str, Box<dyn Fn(&mut World) -> Result<()> + Send + Sync>)>,
|
||||||
&str,
|
|
||||||
Box<dyn Fn(&mut Commands, &mut GuiHandler) -> Result<()> + Send + Sync>,
|
|
||||||
)>,
|
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue