clean
This commit is contained in:
parent
250c3a510a
commit
1d227e6ca6
4 changed files with 31 additions and 15 deletions
22
Cargo.toml
22
Cargo.toml
|
|
@ -2,13 +2,23 @@
|
||||||
name = "montociel"
|
name = "montociel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = "0.5"
|
# bevy = {version="0.5", default-features = false}
|
||||||
|
bevy = {version = "0.5", default-features = false, features = ["bevy_winit", "render"]}
|
||||||
|
bevy_webgl2 = "0.5"
|
||||||
bevy_rapier2d = "*"
|
bevy_rapier2d = "*"
|
||||||
rand = "*"
|
rand = "0.8"
|
||||||
|
getrandom = { version = "0.2", features = ["js"] }
|
||||||
|
|
||||||
[package.metadata.android]
|
wasm-bindgen = "0.2"
|
||||||
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
|
|
||||||
target_sdk_version = 29
|
# Dependencies for native only.
|
||||||
min_sdk_version = 16
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
bevy = {version = "0.5", default-features = false, features = ["bevy_wgpu", "bevy_winit", "render", "x11"]}
|
||||||
|
|
||||||
|
# Dependencies for WASM only.
|
||||||
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
|
bevy = {version = "0.5", default-features = false, features = ["bevy_winit", "render"]}
|
||||||
|
bevy_webgl2 = "0.5"
|
||||||
|
|
|
||||||
21
src/main.rs
21
src/main.rs
|
|
@ -1,5 +1,7 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_rapier2d::prelude::*;
|
use bevy_rapier2d::prelude::*;
|
||||||
|
use bevy_webgl2;
|
||||||
|
use wasm_bindgen::prelude::*;
|
||||||
|
|
||||||
mod cloud;
|
mod cloud;
|
||||||
mod montociel;
|
mod montociel;
|
||||||
|
|
@ -50,10 +52,16 @@ pub enum AppState {
|
||||||
GameOver,
|
GameOver,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
pub fn main() {
|
||||||
App::build()
|
let mut app = App::build();
|
||||||
.add_plugins(DefaultPlugins)
|
|
||||||
.add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
|
app.add_plugins(DefaultPlugins);
|
||||||
|
|
||||||
|
// when building for Web, use WebGL2 rendering
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
app.add_plugin(bevy_webgl2::WebGL2Plugin);
|
||||||
|
|
||||||
|
app.add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
|
||||||
.insert_resource(ClearColor(Color::rgb(1.0, 0.714, 0.757)))
|
.insert_resource(ClearColor(Color::rgb(1.0, 0.714, 0.757)))
|
||||||
.init_resource::<Materials>()
|
.init_resource::<Materials>()
|
||||||
.add_plugin(MontocielPlugin)
|
.add_plugin(MontocielPlugin)
|
||||||
|
|
@ -61,6 +69,7 @@ fn main() {
|
||||||
.add_plugin(ScorePlugin)
|
.add_plugin(ScorePlugin)
|
||||||
.add_plugin(UIPlugin)
|
.add_plugin(UIPlugin)
|
||||||
.add_state(AppState::Menu)
|
.add_state(AppState::Menu)
|
||||||
.add_system_set(SystemSet::on_enter(AppState::Menu).with_system(setup.system()))
|
.add_system_set(SystemSet::on_enter(AppState::Menu).with_system(setup.system()));
|
||||||
.run();
|
|
||||||
|
app.run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ fn setup_score_ui(
|
||||||
mut score: ResMut<Score>,
|
mut score: ResMut<Score>,
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
) {
|
) {
|
||||||
//commands.spawn_bundle(UiCameraBundle::default());
|
|
||||||
score.reset();
|
score.reset();
|
||||||
commands
|
commands
|
||||||
.spawn_bundle(TextBundle {
|
.spawn_bundle(TextBundle {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ impl Plugin for UIPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn button_system(
|
fn button_system(
|
||||||
//button_materials: Res<ButtonMaterials>,
|
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut interaction_query: Query<&Interaction, (Changed<Interaction>, With<Button>)>,
|
mut interaction_query: Query<&Interaction, (Changed<Interaction>, With<Button>)>,
|
||||||
entities: Query<Entity, Without<bevy::render::camera::Camera>>,
|
entities: Query<Entity, Without<bevy::render::camera::Camera>>,
|
||||||
|
|
@ -54,7 +53,6 @@ fn setup_button(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
asset_server: Res<AssetServer>,
|
asset_server: Res<AssetServer>,
|
||||||
state: Res<State<AppState>>,
|
state: Res<State<AppState>>,
|
||||||
//button_materials: Res<ButtonMaterials>,
|
|
||||||
) {
|
) {
|
||||||
let text = match state.current() {
|
let text = match state.current() {
|
||||||
AppState::Menu => "Play!",
|
AppState::Menu => "Play!",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue