2022-08-21 17:17:55 +00:00
|
|
|
mod game;
|
2022-08-23 10:02:58 +00:00
|
|
|
mod levels;
|
2022-08-21 17:17:55 +00:00
|
|
|
mod menu;
|
|
|
|
|
|
|
|
use bevy::{
|
|
|
|
core_pipeline::clear_color::ClearColorConfig,
|
|
|
|
prelude::*,
|
|
|
|
render::settings::{WgpuFeatures, WgpuSettings},
|
|
|
|
};
|
|
|
|
use bevy_fundsp::prelude::*;
|
|
|
|
use bevy_hanabi::*;
|
|
|
|
use bevy_rapier2d::prelude::*;
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
|
|
|
enum AppState {
|
|
|
|
Menu,
|
|
|
|
Game,
|
2022-08-23 10:02:58 +00:00
|
|
|
Win,
|
2022-08-21 17:17:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut options = WgpuSettings::default();
|
|
|
|
options
|
|
|
|
.features
|
|
|
|
.set(WgpuFeatures::VERTEX_WRITABLE_STORAGE, true);
|
|
|
|
App::new()
|
|
|
|
.insert_resource(options)
|
|
|
|
.add_state(AppState::Menu)
|
|
|
|
.add_plugins(DefaultPlugins)
|
|
|
|
.add_plugin(DspPlugin)
|
|
|
|
.add_plugin(HanabiPlugin)
|
|
|
|
.add_plugin(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(64.0))
|
|
|
|
.add_plugin(RapierDebugRenderPlugin::default())
|
|
|
|
.add_plugin(menu::MenuPlugin)
|
|
|
|
.add_plugin(game::GamePlugin)
|
|
|
|
.add_startup_system(setup)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn setup(
|
|
|
|
mut commands: Commands,
|
|
|
|
mut dsp_manager: ResMut<DspManager>,
|
|
|
|
asset_server: Res<AssetServer>,
|
|
|
|
) {
|
|
|
|
let _font: Handle<Font> = asset_server.load("Cantarell-VF.otf");
|
|
|
|
|
|
|
|
commands.spawn_bundle(Camera2dBundle {
|
|
|
|
camera_2d: Camera2d {
|
|
|
|
clear_color: ClearColorConfig::Custom(Color::BLACK),
|
|
|
|
},
|
|
|
|
..Default::default()
|
|
|
|
});
|
|
|
|
commands.insert_resource(AmbientLight {
|
|
|
|
color: Color::WHITE,
|
|
|
|
brightness: 0.6,
|
|
|
|
});
|
|
|
|
dsp_manager.add_graph(game::sine_wave, 1.0);
|
|
|
|
}
|