use beet_core::prelude::*;
#[derive(Default, Component, Reflect)]
#[reflect(Default, Component)]
pub struct Emoji {
hexcode: String,
}
pub fn emoji_plugin(app: &mut App) {
app.register_type::<Emoji>()
.world_mut()
.register_component_hooks::<Emoji>()
.on_add(|mut world, cx| {
let hexcode =
world.get::<Emoji>(cx.entity).unwrap().hexcode().to_string();
world
.commands()
.entity(cx.entity)
.insert(Emoji::bundle(&hexcode));
});
}
impl Emoji {
pub fn new(hexcode: &str) -> Self {
Self {
hexcode: hexcode.to_uppercase(),
}
}
pub fn hexcode(&self) -> &str { &self.hexcode }
pub fn set_hexcode(&mut self, hexcode: &str) {
self.hexcode = hexcode.to_uppercase();
}
pub fn bundle(_hexcode: &str) -> impl Bundle {
todo!("construct bundle");
()
}
}