Newer
Older
use bevy::app::PluginGroupBuilder;
use bevy::log::{Level, LogPlugin};
use crate::system::load_config::{get_asset_path_string, initial_size};
pub struct DefaultResourcesPlugin;
impl Plugin for DefaultResourcesPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(Msaa { samples: 1 })
.insert_resource(ClearColor(Color::hex("040720").unwrap()));
}
}
pub fn configure_default_plugins() -> PluginGroupBuilder {
let (width, height) = initial_size();
DefaultPlugins
.set(WindowPlugin {
window: WindowDescriptor {
width,
height,
resizable: true,
mode: WindowMode::Windowed,
title: String::from("Bevy 2D Template"),
present_mode: PresentMode::AutoNoVsync,
asset_folder: get_asset_path_string(),
watch_for_changes: true,
})
.set(ImagePlugin::default_nearest())
.set(LogPlugin {
filter: String::from(
"info,symphonia_core=warn,symphonia_bundle_mp3=warn,wgpu_core=warn,wgpu_hal=warn",
),
level: Level::DEBUG,
})
}
pub struct InitAppPlugins;
impl PluginGroup for InitAppPlugins {
fn build(self) -> PluginGroupBuilder {
configure_default_plugins().add(DefaultResourcesPlugin).add(super::web::WebPlugin)