use crate::anyslot::*;
#[derive(Debug, Clone)]
pub struct CustomSlotSample {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8
}
impl TBridgeGlobal for CustomSlotSample {
fn void() -> Self {
CustomSlotSample::new(0, 0, 0, 0)
}
}
impl CustomSlotSample {
pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self {
CustomSlotSample{r, g, b, a}
}
}
pub fn minimum_test() {
any_pinned_init_slots!(8);
any_pinned_set_bg_mut!(bridge_global, 0);
any_pinned_set_bg_mut!(CustomSlotSample, 1);
any_pinned_with_bg_mut!(bridge_global, 0, |bg| {
bg.num = 0;
});
any_pinned_with_bg_mut!(CustomSlotSample, 1, |bg| {
*bg = CustomSlotSample::new(240, 192, 32, 255);
});
let local_value = 128i32;
any_pinned_with_bg_mut!(bridge_global, 0, move |bg| {
if local_value != bg.num as i32 {
bg.num = local_value as usize;
println!("value changed: local_value = {}", local_value);
}
});
let mut col = CustomSlotSample::void();
any_pinned_with_bg_mut!(CustomSlotSample, 1, |bg| {
println!("{:?}", bg);
col = bg.clone();
});
any_pinned_dispose_slots!();
}