Compare commits

..

No commits in common. '57e8caa1b76043f142d271f581c300dee5941a2d' and '3fe21d45e91189e0fa2d0c8257ef7f541f46e146' have entirely different histories.

193
Cargo.lock generated

@ -510,30 +510,6 @@ dependencies = [
"encase_derive_impl", "encase_derive_impl",
] ]
[[package]]
name = "bevy_eventlistener"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9d65c75b4f81818cacdc8a4302c5413910c5fb7727564deaf95e56e0dea4bd0"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_eventlistener_derive",
"bevy_hierarchy",
"bevy_utils",
]
[[package]]
name = "bevy_eventlistener_derive"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa29be733a02a5d7ca4507ef15f294711c1a0884b9a9a2730640ff4e7d0200ab"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.66",
]
[[package]] [[package]]
name = "bevy_gilrs" name = "bevy_gilrs"
version = "0.13.2" version = "0.13.2"
@ -730,54 +706,6 @@ dependencies = [
"glam", "glam",
] ]
[[package]]
name = "bevy_mod_picking"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d79f17a34025d95e2e3525207ec73090647c6f40c3136fc674f87e167a9ae6be"
dependencies = [
"bevy_app",
"bevy_core",
"bevy_core_pipeline",
"bevy_ecs",
"bevy_eventlistener",
"bevy_math",
"bevy_picking_core",
"bevy_picking_highlight",
"bevy_picking_input",
"bevy_picking_raycast",
"bevy_picking_selection",
"bevy_picking_sprite",
"bevy_picking_ui",
"bevy_reflect",
"bevy_render",
"bevy_text",
"bevy_ui",
"bevy_utils",
"bevy_window",
]
[[package]]
name = "bevy_mod_raycast"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ca646aeaab4a170e1f3e8284b925e2f990eb18616e95d7826c873c8e26ee945"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_derive",
"bevy_ecs",
"bevy_gizmos",
"bevy_math",
"bevy_reflect",
"bevy_render",
"bevy_sprite",
"bevy_transform",
"bevy_utils",
"bevy_window",
"crossbeam-channel",
]
[[package]] [[package]]
name = "bevy_pbr" name = "bevy_pbr"
version = "0.13.2" version = "0.13.2"
@ -803,126 +731,6 @@ dependencies = [
"thread_local", "thread_local",
] ]
[[package]]
name = "bevy_picking_core"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c8cdca408508a7d006bf077c6cbb6660a65895323333f206b7cce7b801a8e2"
dependencies = [
"bevy_app",
"bevy_derive",
"bevy_ecs",
"bevy_eventlistener",
"bevy_math",
"bevy_reflect",
"bevy_render",
"bevy_transform",
"bevy_utils",
"bevy_window",
]
[[package]]
name = "bevy_picking_highlight"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e684569b5f7dae06d1ff66e2287cee808b3862d9ae0d01dbe114d7d199d40cfd"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_ecs",
"bevy_pbr",
"bevy_picking_core",
"bevy_picking_selection",
"bevy_reflect",
"bevy_render",
"bevy_sprite",
]
[[package]]
name = "bevy_picking_input"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60182209f48943de6c8bc3305a70f52012a18ef26f92f460f9436441b8badf0b"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_hierarchy",
"bevy_input",
"bevy_math",
"bevy_picking_core",
"bevy_picking_selection",
"bevy_reflect",
"bevy_render",
"bevy_utils",
"bevy_window",
]
[[package]]
name = "bevy_picking_raycast"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2677d0a3402fea3327a216649c104f969685a5c01d969d274c89facba86c164d"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_mod_raycast",
"bevy_picking_core",
"bevy_reflect",
"bevy_render",
"bevy_transform",
"bevy_window",
]
[[package]]
name = "bevy_picking_selection"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbc986eefd38058918322418d1e6ae398e74d48730e623a55dc20be78d5ee24b"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_eventlistener",
"bevy_input",
"bevy_picking_core",
"bevy_reflect",
"bevy_utils",
]
[[package]]
name = "bevy_picking_sprite"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ac5309026e8c7f5aed2afec3aa2f21fb0a0487e9bb3d851860377891459df75"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_ecs",
"bevy_math",
"bevy_picking_core",
"bevy_render",
"bevy_sprite",
"bevy_transform",
"bevy_window",
]
[[package]]
name = "bevy_picking_ui"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85ad6d40e33203115af38adc984341cf5637911baa940028b6a43a9917d64e79"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_hierarchy",
"bevy_math",
"bevy_picking_core",
"bevy_render",
"bevy_transform",
"bevy_ui",
"bevy_utils",
"bevy_window",
]
[[package]] [[package]]
name = "bevy_ptr" name = "bevy_ptr"
version = "0.13.2" version = "0.13.2"
@ -1925,7 +1733,6 @@ name = "game-jam-casino"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy_mod_picking",
"wee_alloc", "wee_alloc",
] ]

@ -6,7 +6,6 @@ edition = "2021"
[dependencies] [dependencies]
bevy = "0.13" bevy = "0.13"
wee_alloc = "*" wee_alloc = "*"
bevy_mod_picking = "0.18"
[profile.wasm-release] [profile.wasm-release]
inherits = "release" inherits = "release"

@ -1,31 +0,0 @@
//! A minimal 2d example.
use bevy::{prelude::*, sprite::MaterialMesh2dBundle};
use bevy_mod_picking::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(low_latency_window_plugin()))
.add_plugins(DefaultPickingPlugins)
.insert_resource(DebugPickingMode::Normal)
.add_systems(Startup, setup)
.run();
}
/// Set up a simple 2D scene
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(Camera2dBundle::default());
commands.spawn((
MaterialMesh2dBundle {
mesh: meshes.add(Rectangle::default()).into(),
transform: Transform::default().with_scale(Vec3::splat(128.)),
material: materials.add(ColorMaterial::from(Color::PURPLE)),
..default()
},
PickableBundle::default(), // <- Makes the mesh pickable.
));
}

@ -26,7 +26,7 @@ enum DiceAction {
/// Create UI for the Dice game at startup /// Create UI for the Dice game at startup
fn init_dice_ui(mut commands: Commands) { fn init_dice_ui(mut commands: Commands) {
commands commands
.spawn((GameChoice::Dice, MenuState::Closed, Pickable::IGNORE)) .spawn((GameChoice::Dice, MenuState::Closed))
.add(UiContainer) .add(UiContainer)
.with_children(|parent| { .with_children(|parent| {
parent parent
@ -72,34 +72,23 @@ fn init_dice(
mut materials: ResMut<Assets<ColorMaterial>>, mut materials: ResMut<Assets<ColorMaterial>>,
mut commands: Commands mut commands: Commands
) { ) {
[ commands.spawn((
["a", "b", "c", "d", "e", "f"], GameChoice::Dice, MenuState::Closed,
["g", "h", "i", "j", "k", "l"], Die::new(["a", "b", "c", "d", "e", "f"]),
["m", "n", "o", "p", "q", "r"], )).insert(Text2dBundle {
].into_iter().enumerate().for_each(|(idx, set)| { text: Text::from_section(
commands.spawn(( "",
GameChoice::Dice, MenuState::Closed, TextStyle {
Die::new(set), color: Color::BLACK,
PickableBundle { ..default() }, font_size: 32.0,
On::<Pointer<Drag>>::target_component_mut::<Transform>(|m, transform| { ..default()
transform.translation.x += m.delta.x; },
transform.translation.y -= m.delta.y; ),
}) ..default()
)).insert(MaterialMesh2dBundle { }).insert(MaterialMesh2dBundle {
mesh: meshes.add(Rectangle { half_size: Vec2::splat(32.0) }).into(), mesh: meshes.add(Rectangle { half_size: Vec2::splat(32.0) }).into(),
material: materials.add(Color::PINK), material: materials.add(Color::PINK),
..default() ..default()
}).insert(Text2dBundle {
text: Text::from_section(
"",
TextStyle {
color: Color::BLACK,
font_size: 32.0,
..default()
},
),
..default()
}).insert(Transform::from_xyz(idx as f32 * 100.0, 100.0, 0.0));
}); });
} }
@ -114,7 +103,7 @@ fn roll_die(mut r: EventReader<DiceAction>, mut q: Query<&mut Die>, time: Res<Ti
r.read().for_each(|msg| match msg { r.read().for_each(|msg| match msg {
DiceAction::Roll => { DiceAction::Roll => {
q.iter_mut().for_each(|mut d| { q.iter_mut().for_each(|mut d| {
d.roll((time.elapsed_seconds() * 1000.0) as usize); d.roll(time.elapsed_seconds() as usize);
}); });
} }
}); });

@ -9,8 +9,8 @@ pub(crate) struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.init_state::<GameChoice>(); app.init_state::<GameChoice>();
app.add_plugins(dice::DicePlugin);
app.add_systems(Startup, init_camera); app.add_systems(Startup, init_camera);
app.add_plugins(dice::DicePlugin);
app.add_systems( app.add_systems(
Update, Update,
manage_visibility::<GameChoice>.run_if(state_changed::<GameChoice>), manage_visibility::<GameChoice>.run_if(state_changed::<GameChoice>),

@ -18,12 +18,11 @@ pub(crate) mod prelude;
pub(crate) mod game; pub(crate) mod game;
use crate::prelude::*; use bevy::prelude::*;
fn main() { fn main() {
let mut app = App::new(); let mut app = App::new();
app.add_plugins(bevy::DefaultPlugins.set(low_latency_window_plugin())); app.add_plugins(DefaultPlugins);
app.add_plugins(bevy_mod_picking::DefaultPickingPlugins);
app.add_plugins(menu::MenuPlugin); app.add_plugins(menu::MenuPlugin);
app.add_plugins(ui::UiPlugin); app.add_plugins(ui::UiPlugin);
app.add_plugins(game::GamePlugin); app.add_plugins(game::GamePlugin);

@ -29,7 +29,7 @@ pub(crate) enum MenuState {
/// Initialize menu UI nodes at startup /// Initialize menu UI nodes at startup
fn init_menu_ui(mut commands: Commands) { fn init_menu_ui(mut commands: Commands) {
commands commands
.spawn((MenuState::Open, GameChoice::None, Pickable::IGNORE)) .spawn((MenuState::Open, GameChoice::None))
.add(UiContainer) .add(UiContainer)
.with_children(|parent| { .with_children(|parent| {
parent.spawn_empty().add(UiTitle { parent.spawn_empty().add(UiTitle {

@ -7,8 +7,6 @@ pub(crate) use bevy::input::keyboard::KeyboardInput;
pub(crate) use bevy::input::ButtonState; pub(crate) use bevy::input::ButtonState;
pub(crate) use bevy::sprite::MaterialMesh2dBundle; pub(crate) use bevy::sprite::MaterialMesh2dBundle;
/// Bevy Plugins
pub(crate) use bevy_mod_picking::prelude::*;
/// Intra-project imports /// Intra-project imports
pub(crate) use crate::ecs::schedule::common_conditions::*; pub(crate) use crate::ecs::schedule::common_conditions::*;

@ -77,7 +77,6 @@ pub(crate) mod button {
..default() ..default()
}, },
border_color: BorderColor(Color::BLACK), border_color: BorderColor(Color::BLACK),
z_index: ZIndex::Local(-1),
..default() ..default()
}) })
.with_children(|parent| { .with_children(|parent| {
@ -110,7 +109,6 @@ pub(crate) mod title {
margin: UiRect::all(Val::Px(5.0)), margin: UiRect::all(Val::Px(5.0)),
..default() ..default()
}, },
z_index: ZIndex::Local(-2),
..default() ..default()
}); });
} }
@ -137,7 +135,7 @@ pub(crate) mod container {
..default() ..default()
}, },
border_color: BorderColor(Color::BLACK), border_color: BorderColor(Color::BLACK),
z_index: ZIndex::Local(-3), z_index: ZIndex::Local(-1),
..default() ..default()
}); });
} }

Loading…
Cancel
Save