Fix visibility warnings

This commit is contained in:
Daniel Flanagan 2024-08-02 11:39:59 -05:00
parent 64f2e7b149
commit fa05ed187b
5 changed files with 358 additions and 11 deletions

324
Cargo.lock generated
View file

@ -180,6 +180,24 @@ dependencies = [
"num-traits",
]
[[package]]
name = "arboard"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89"
dependencies = [
"clipboard-win",
"core-graphics",
"image 0.25.2",
"log",
"objc2",
"objc2-app-kit",
"objc2-foundation",
"parking_lot",
"windows-sys 0.48.0",
"x11rb",
]
[[package]]
name = "arrayref"
version = "0.3.8"
@ -298,6 +316,50 @@ dependencies = [
"bevy_internal",
]
[[package]]
name = "bevy-inspector-egui"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8d77dbe53c8840aa74b66ea19dac6675d0a1752c989610cbded909d03967bec"
dependencies = [
"bevy-inspector-egui-derive",
"bevy_app",
"bevy_asset",
"bevy_color",
"bevy_core",
"bevy_core_pipeline",
"bevy_ecs",
"bevy_egui",
"bevy_hierarchy",
"bevy_log",
"bevy_math",
"bevy_pbr",
"bevy_reflect",
"bevy_render",
"bevy_state",
"bevy_time",
"bevy_utils",
"bevy_window",
"bytemuck",
"egui",
"fuzzy-matcher",
"image 0.24.9",
"once_cell",
"pretty-type-name",
"smallvec",
]
[[package]]
name = "bevy-inspector-egui-derive"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "161d93f4b3a9246a87485e30ccf4cc927f204a14f26df42da977e383f0a0ec5d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.72",
]
[[package]]
name = "bevy_a11y"
version = "0.14.0"
@ -513,6 +575,28 @@ dependencies = [
"syn 2.0.72",
]
[[package]]
name = "bevy_egui"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4a90f30f2849a07d91e393b10c0cc05df09b5773c010ddde57dd8b583be230"
dependencies = [
"arboard",
"bevy",
"bytemuck",
"console_log",
"crossbeam-channel",
"egui",
"js-sys",
"log",
"thread_local",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webbrowser",
"winit",
]
[[package]]
name = "bevy_encase_derive"
version = "0.14.0"
@ -790,7 +874,7 @@ dependencies = [
"encase",
"futures-lite",
"hexasphere",
"image",
"image 0.25.2",
"js-sys",
"naga",
"naga_oil",
@ -1170,6 +1254,12 @@ dependencies = [
"syn 2.0.72",
]
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "byteorder-lite"
version = "0.1.0"
@ -1262,6 +1352,15 @@ dependencies = [
"libloading 0.8.5",
]
[[package]]
name = "clipboard-win"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892"
dependencies = [
"error-code",
]
[[package]]
name = "codespan-reporting"
version = "0.11.1"
@ -1272,6 +1371,12 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "color_quant"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "com"
version = "0.6.0"
@ -1332,6 +1437,16 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "console_log"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f"
dependencies = [
"log",
"web-sys",
]
[[package]]
name = "const-fnv1a-hash"
version = "1.1.0"
@ -1537,12 +1652,43 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"
[[package]]
name = "ecolor"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e6b451ff1143f6de0f33fc7f1b68fecfd2c7de06e104de96c4514de3f5396f8"
dependencies = [
"bytemuck",
"emath",
]
[[package]]
name = "egui"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20c97e70a2768de630f161bb5392cbd3874fcf72868f14df0e002e82e06cb798"
dependencies = [
"ahash",
"emath",
"epaint",
"nohash-hasher",
]
[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "emath"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6a21708405ea88f63d8309650b4d77431f4bc28fb9d8e6f77d3963b51249e6"
dependencies = [
"bytemuck",
]
[[package]]
name = "encase"
version = "0.8.0"
@ -1575,6 +1721,21 @@ dependencies = [
"syn 2.0.72",
]
[[package]]
name = "epaint"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f0dcc0a0771e7500e94cd1cb797bd13c9f23b9409bdc3c824e2cbc562b7fa01"
dependencies = [
"ab_glyph",
"ahash",
"bytemuck",
"ecolor",
"emath",
"nohash-hasher",
"parking_lot",
]
[[package]]
name = "equivalent"
version = "1.0.1"
@ -1601,6 +1762,12 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "error-code"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b"
[[package]]
name = "euclid"
version = "0.22.10"
@ -1701,6 +1868,15 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "form_urlencoded"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
[[package]]
name = "futures-core"
version = "0.3.30"
@ -1726,6 +1902,15 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "fuzzy-matcher"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
dependencies = [
"thread_local",
]
[[package]]
name = "gethostname"
version = "0.4.3"
@ -1925,12 +2110,43 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
[[package]]
name = "home"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "hound"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
name = "idna"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "image"
version = "0.24.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"num-traits",
]
[[package]]
name = "image"
version = "0.25.2"
@ -1941,6 +2157,7 @@ dependencies = [
"byteorder-lite",
"num-traits",
"png",
"tiff",
]
[[package]]
@ -2002,6 +2219,12 @@ dependencies = [
"libc",
]
[[package]]
name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]]
name = "js-sys"
version = "0.3.69"
@ -2033,6 +2256,7 @@ name = "kodotag-rs"
version = "0.1.0"
dependencies = [
"bevy",
"bevy-inspector-egui",
"bevy_framepace",
]
@ -2281,6 +2505,12 @@ dependencies = [
"jni-sys",
]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
version = "7.1.3"
@ -2759,6 +2989,12 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"
[[package]]
name = "pretty-type-name"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f73cdaf19b52e6143685c3606206e114a4dfa969d6b14ec3894c88eb38bd4b"
[[package]]
name = "proc-macro-crate"
version = "3.1.0"
@ -3227,6 +3463,17 @@ dependencies = [
"once_cell",
]
[[package]]
name = "tiff"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e"
dependencies = [
"flate2",
"jpeg-decoder",
"weezl",
]
[[package]]
name = "tiny-skia"
version = "0.11.4"
@ -3252,6 +3499,21 @@ dependencies = [
"strict-num",
]
[[package]]
name = "tinyvec"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml_datetime"
version = "0.6.8"
@ -3374,12 +3636,27 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf"
[[package]]
name = "unicode-bidi"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "unicode-normalization"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-segmentation"
version = "1.11.0"
@ -3398,6 +3675,17 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "url"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]
[[package]]
name = "uuid"
version = "1.10.0"
@ -3607,6 +3895,7 @@ checksum = "43676fe2daf68754ecf1d72026e4e6c15483198b5d24e888b74d3f22f887a148"
dependencies = [
"dlib",
"log",
"once_cell",
"pkg-config",
]
@ -3630,6 +3919,30 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webbrowser"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e"
dependencies = [
"block2",
"core-foundation",
"home",
"jni",
"log",
"ndk-context",
"objc2",
"objc2-foundation",
"url",
"web-sys",
]
[[package]]
name = "weezl"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]]
name = "wgpu"
version = "0.20.1"
@ -3857,6 +4170,15 @@ dependencies = [
"windows-targets 0.42.2",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
name = "windows-sys"
version = "0.52.0"

View file

@ -35,6 +35,7 @@ bevy = { version = "0.14.0", default-features = false, features = [
# "bevy_dev_tools", # possibly-useful development tools
# "detailed_trace", # probably useful troubleshooting information during runtime
] }
bevy-inspector-egui = "0.25.1"
bevy_framepace = "0.17.1"
[profile.dev]

View file

@ -62,14 +62,10 @@ pub fn process_input(
let modified_target = target.with_y(size.y - target.y) - center;
gizmos.line(Vec2::ZERO.extend(0.), modified_target.extend(0.), RED);
input.angle = modified_target.to_angle();
info!(
"pos@{target:?} -- {center:?} -> {modified_target:?} for angle of {:?}",
input.angle
);
}
}
info!("Input: {:#?}", input);
// info!("Input: {:#?}", input);
}
// TODO: controller input: https://bevy-cheatbook.github.io/input/gamepad.html

View file

@ -36,6 +36,8 @@ struct MainMenuSet;
#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
struct InGameSet;
const AUDIO_SCALE: f32 = 1. / 200.0;
fn main() -> AppExit {
let mut app = App::new();
@ -52,13 +54,14 @@ fn main() -> AppExit {
..default()
})
.set(AudioPlugin {
default_spatial_scale: SpatialScale::new_2d(1.),
default_spatial_scale: SpatialScale::new_2d(AUDIO_SCALE),
global_volume: GlobalVolume::new(1.),
..default()
})
.set(ImagePlugin::default_nearest()),
FrameTimeDiagnosticsPlugin,
bevy_framepace::FramepacePlugin,
bevy_inspector_egui::quick::WorldInspectorPlugin::new(),
));
load_internal_binary_asset!(
@ -97,6 +100,7 @@ fn main() -> AppExit {
(update,).after(input::process_input),
(
player::control,
player::meow_on_r,
player::player_debug_info,
statue::spawn_statue,
movement::update_velocity_by_heading,

View file

@ -5,7 +5,7 @@ use crate::movement::{Heading, Mover, Speed, Velocity, YSortable};
use crate::prelude::*;
use bevy::sprite::MaterialMesh2dBundle;
const PLAYER_SPEED: f32 = 200.;
const PLAYER_SPEED: f32 = 500.;
// #[derive(Resource, Default)]
// pub struct Layout(Handle<TextureAtlasLayout>);
@ -41,6 +41,10 @@ pub fn startup(
commands
.spawn((
Player,
VisibilityBundle {
visibility: Visibility::Inherited,
..default()
},
YSortable,
Watched,
Transform::default(),
@ -78,7 +82,7 @@ pub fn startup(
text.transform.translation.z = 500.0;
text.transform.translation.y = 24.;
player.spawn(text);
player.spawn((SpatialBundle::default(), SpatialListener::new(1.)));
player.spawn((SpatialBundle::default(), SpatialListener::new(10.)));
player.spawn((
Crosshair,
MaterialMesh2dBundle {
@ -105,9 +109,29 @@ pub fn control(
}
}
pub fn meow_on_r(
mut commands: Commands,
assets: Res<AssetServer>,
player: Query<Entity, With<Player>>,
keys: Res<ButtonInput<KeyCode>>,
) {
if keys.just_pressed(KeyCode::KeyR) {
if let Ok(player) = player.get_single() {
let sound = commands
.spawn(AudioSourceBundle {
source: assets.load::<AudioSource>("sfx/meow.wav"),
settings: PlaybackSettings::DESPAWN.with_spatial(true),
..default()
})
.id();
commands.entity(player).push_children(&[sound]);
}
}
}
pub fn player_debug_info(mut player: Query<(&Heading, &Transform), With<Player>>) {
if let Ok((heading, transform)) = player.get_single_mut() {
info!("{heading:#?} {transform:#?}");
if let Ok((_heading, _transform)) = player.get_single_mut() {
// info!("{heading:#?} {transform:#?}");
}
}