use bevy::prelude::*;
use bevy::render::batching::gpu_preprocessing::{
    GpuPreprocessingMode,
    GpuPreprocessingSupport,
};
use bevy::window::{
    ExitCondition,
    PresentMode,
    WindowTheme,
};
use bevy_render::RenderApp;
use kodumaro_nonogram::prelude::*;

fn main() {
    let mut app = App::new();
    app
        .add_plugins(
            DefaultPlugins.set(WindowPlugin {
                primary_window: Some(Window {
                    title: consts::TITLE.into(),
                    name: Some("Kodumaro-nonogram".to_string()),
                    present_mode: PresentMode::AutoVsync,
                    window_theme: Some(WindowTheme::Light),
                    resize_constraints: WindowResizeConstraints {
                        min_width: consts::RESOLUTION.x,
                        min_height: consts::RESOLUTION.y,
                        ..default()
                    },
                    ..default()
                }),
                exit_condition: ExitCondition::OnPrimaryClosed,
                ..default()
            })
        )
        .add_plugins(NonogramApp)

        // Sub-app
        .sub_app_mut(RenderApp)
        .insert_resource(GpuPreprocessingSupport {
            max_supported_mode:GpuPreprocessingMode::None,
        })
    ;
    app.run();
}
