use astrelis::prelude::*;
struct SimpleApp;
impl astrelis_winit::app::App for SimpleApp {
fn on_start(&mut self, _ctx: &mut astrelis_winit::app::AppCtx) {
println!("✓ App started!");
println!("✓ Window created automatically by ApplicationBuilder");
println!("✓ WindowManager initialized automatically");
}
fn update(&mut self, _ctx: &mut astrelis_winit::app::AppCtx, time: &astrelis_winit::FrameTime) {
if time.frame_count.is_multiple_of(60) {
println!(
"Frame {}: {:.1} FPS",
time.frame_count,
1.0 / time.delta.as_secs_f32()
);
}
}
fn render(
&mut self,
_ctx: &mut astrelis_winit::app::AppCtx,
window_id: astrelis_winit::WindowId,
events: &mut astrelis_winit::event::EventBatch,
) {
let _ = (window_id, events);
}
fn on_exit(&mut self, _ctx: &mut astrelis_winit::app::AppCtx) {
println!("✓ App exiting gracefully!");
}
}
fn main() {
astrelis_core::logging::init();
ApplicationBuilder::new()
.with_title("Simple Application - ApplicationBuilder Demo")
.with_size(800, 600)
.add_plugins(DefaultPlugins)
.run(|_ctx, _engine| {
SimpleApp
});
}