mod components; mod events; mod resources; mod systems; #[macro_use] extern crate prettytable; use bevy_app::prelude::*; use bevy_ecs::prelude::*; use bevy_erm::*; use components::*; use events::*; use resources::*; use systems::*; pub struct MarketplacePlugin; impl Plugin for MarketplacePlugin { fn build(&self, app: &mut App) { app.add_plugins(EntityRelationMapperPlugin) .add_systems( PostUpdate, flush_component_to_db::< ( Option<&User>, Option<&PurchasedItem>, Option<&Buyer>, Option<&Seller>, Option<&MarketItem>, ), SqlxSqliteDatabaseResource, >, ) .add_event::() .add_event::() .add_event::() .add_event::() .add_event::() .init_resource::() .add_systems(Startup, create_tables) .add_systems(PreUpdate, poll_webserver_for_requests) .add_systems(PreUpdate, should_exit) .add_systems(Update, purchase_system) .add_systems(Update, flush_purchase.after(purchase_system)) .add_systems(PostUpdate, print_items_table) .add_systems(PostUpdate, print_users_table) .add_systems(PostUpdate, print_purchased_items_table); } } #[tokio::main] async fn main() { App::new() .set_runner(runner) .add_plugins(MarketplacePlugin) .run(); }