pub trait ControlObjectBehavior<Img, Snd, Fnt, Spr, Rm, Data>: ControlObjectBehaviorClone<Img, Snd, Fnt, Spr, Rm, Data>where
Spr: IndexRestriction,
Img: IndexRestriction,
Snd: IndexRestriction,
Fnt: IndexRestriction,
Rm: IndexRestriction,
Data: Clone,{
// Required method
fn data(&self) -> Data;
// Provided methods
fn handle_sdl_event(&mut self, _event: &Event) { ... }
fn update(
&mut self,
_delta: f64,
_cur_room: &Rm,
_others: &Vec<Box<dyn ControlObjectBehavior<Img, Snd, Fnt, Spr, Rm, Data>>>,
_room_objs: &Vec<Box<dyn GameObjectBehavior<Img, Snd, Fnt, Spr, Rm, Data>>>,
) -> (Option<Rm>, Vec<Box<dyn GameObjectBehavior<Img, Snd, Fnt, Spr, Rm, Data>>>) { ... }
fn render(
&mut self,
_cnv: &mut Canvas<Window>,
_cur_room: &Rm,
_imgs: &HashMap<Img, Image<'_>>,
_snds: &HashMap<Snd, Sound<'_>>,
_fonts: &HashMap<Fnt, Font<'_, '_>>,
_creator: &TextureCreator<WindowContext>,
_elapsed: f64,
) -> Result<(), String> { ... }
}Expand description
Control objects are basically game objects, but they are aware of the current room and do not possess colliders. They are the way for doing dynamic memory