1 2 3 4 5 6 7 8 9 10 11 12
use engine::{Context, Frame}; use ui::{Ui, UiBuilder}; use input::Event; pub trait Game { type Action; fn new(context: &Context, ui_builder: &mut UiBuilder) -> Self; fn on_event(&self, context: &Context, event: Event) -> Option<Self::Action>; fn on_action(&mut self, context: &Context, action: Self::Action); fn on_ui(&mut self, ui: &mut Ui) -> Vec<Self::Action>; fn draw(&self, frame: &mut Frame); }