62 lines
1.7 KiB
Rust
62 lines
1.7 KiB
Rust
mod power;
|
|
mod lib8;
|
|
mod render;
|
|
mod task;
|
|
mod time;
|
|
mod geometry;
|
|
mod platform;
|
|
mod animations;
|
|
mod mappings;
|
|
mod buffers;
|
|
mod events;
|
|
|
|
use events::Event;
|
|
|
|
use crate::events::EventBus;
|
|
use crate::platform::{DefaultBoard, Board};
|
|
use crate::task::{FixedSizeScheduler, Scheduler};
|
|
use crate::render::{Surfaces, Renderer};
|
|
use crate::geometry::Rectangle;
|
|
|
|
fn main() {
|
|
let mut board: DefaultBoard = Board::take();
|
|
|
|
log::info!("Board: {}", core::any::type_name_of_val(&board));
|
|
|
|
log::info!("Creating tasks");
|
|
let mut system = board.system_tasks();
|
|
log::info!("System scheduler: {}", core::any::type_name_of_val(&system));
|
|
|
|
log::info!("Creating output");
|
|
let output = board.output();
|
|
log::info!("Output: {}", core::any::type_name_of_val(&output));
|
|
|
|
log::info!("Preparing surfaces");
|
|
let mut surfaces = board.surfaces();
|
|
log::info!("Surface implementation: {}", core::any::type_name_of_val(&output));
|
|
|
|
log::info!("Creating animations");
|
|
let mut animations = FixedSizeScheduler::new([
|
|
Box::new(animations::IdleTask::new(&mut surfaces)),
|
|
Box::new(animations::TestPattern::new(surfaces.new_surface(&Rectangle::everything()).unwrap())),
|
|
]);
|
|
|
|
let mut renderer = FixedSizeScheduler::new([Box::new(Renderer::new(output, surfaces))]);
|
|
|
|
log::info!("Starting event bus");
|
|
let mut bus = EventBus::new();
|
|
|
|
log::info!("Ready to rock and roll");
|
|
bus.push(Event::new_ready_to_rock());
|
|
loop {
|
|
let next_event = bus.next();
|
|
match next_event {
|
|
events::Event::Tick => (),
|
|
_ => log::info!("Event: {:?}", next_event)
|
|
}
|
|
animations.tick(&next_event, &mut bus);
|
|
system.tick(&next_event, &mut bus);
|
|
renderer.tick(&next_event, &mut bus);
|
|
}
|
|
}
|