WIP upgrade

This commit is contained in:
Daniel Flanagan 2024-05-17 09:11:33 -05:00
parent 5db15f5bc0
commit f36c4eb528
7 changed files with 1034 additions and 878 deletions

View file

@ -1,4 +1,3 @@
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=/nix/store/n6fa181ai5hxjd8dpa2qqhd4lql3475x-mold-2.4.0/bin/mold"]
rustflags = ["-C", "link-arg=-fuse-ld=/nix/store/mda3bjp6rh53lg0l6vjr99b3d7ps4vb3-mold-2.4.0/bin/mold"]

1869
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = { version = "0.12.1", features = ["wayland", "wav"] }
bevy = { version = "0.13.2", features = ["wayland", "wav"] }
# bevy = { version = "0.12.1", features = ["wayland", "file_watcher", "trace"] }
[profile.dev]

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1705856552,
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
"lastModified": 1715787315,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
"type": "github"
},
"original": {

View file

@ -9,8 +9,8 @@ pub struct AssetLoader {
#[derive(Resource, Debug, Default)]
pub struct Sprites {
pub player: Handle<TextureAtlas>,
pub statue: Handle<TextureAtlas>,
pub player: Handle<TextureAtlasLayout>,
pub statue: Handle<TextureAtlasLayout>,
}
#[derive(Resource, Debug, Default)]
@ -35,7 +35,7 @@ impl Plugin for AssetPlugin {
fn load_assets(
mut assets: ResMut<AssetLoader>,
asset_server: Res<AssetServer>,
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
) {
let player_img = asset_server.load("img/Player.png");
let props_img = asset_server.load("img/Props.png");

View file

@ -25,8 +25,8 @@ fn spawn_player(mut commands: Commands, assets: Res<AssetLoader>) {
.spawn((
Player,
SpriteSheetBundle {
texture_atlas: assets.images.player.clone(),
sprite: TextureAtlasSprite::new(0),
atlas: assets.images.player.clone().into(),
sprite: TextureAtlas::new(0),
..Default::default()
},
Mover {
@ -42,9 +42,9 @@ fn spawn_player(mut commands: Commands, assets: Res<AssetLoader>) {
fn controls(
mut commands: Commands,
mut query: Query<(&mut TextureAtlasSprite, &mut Heading, Entity), With<Player>>,
input: Res<Input<KeyCode>>,
mouse_input: Res<Input<MouseButton>>,
mut query: Query<(&mut TextureAtlas, &mut Heading, Entity), With<Player>>,
input: Res<ButtonInput<KeyCode>>,
mouse_input: Res<ButtonInput<MouseButton>>,
assets: Res<AssetLoader>,
q_windows: Query<&Window, With<PrimaryWindow>>,
q_camera: Query<(&Camera, &GlobalTransform), With<Camera>>,
@ -65,8 +65,8 @@ fn controls(
commands.spawn((
Statue,
SpriteSheetBundle {
texture_atlas: assets.images.statue.clone(),
sprite: TextureAtlasSprite::new(0),
atlas: assets.images.statue.clone(),
sprite: TextureAtlas::new(0),
transform: Transform::from_translation(spos),
..Default::default()
},
@ -118,14 +118,14 @@ fn controls(
}
fn sprite_select(
mut query: Query<(&Handle<TextureAtlas>, &mut TextureAtlasSprite), With<Player>>,
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&Handle<TextureAtlasLayout>, &mut TextureAtlas), With<Player>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
texture_atlases: Res<Assets<TextureAtlas>>,
texture_atlases: Res<Assets<TextureAtlasLayout>>,
) {
if keyboard_input.pressed(KeyCode::Escape) {
app_exit_events.send(bevy::app::AppExit);
} else if keyboard_input.just_pressed(KeyCode::N) {
} else if keyboard_input.just_pressed(KeyCode::KeyN) {
let (texture, mut sprite) = query.single_mut();
let t = texture_atlases
.get(texture)

View file

@ -16,7 +16,7 @@ fn spawn_statue(mut commands: Commands, assets: Res<AssetLoader>) {
Statue,
SpriteSheetBundle {
texture_atlas: assets.images.statue.clone(),
sprite: TextureAtlasSprite::new(0),
sprite: TextureAtlas::new(0),
transform: Transform::from_translation(Vec3::new(50., 50., 0.)),
..Default::default()
},
@ -25,7 +25,7 @@ fn spawn_statue(mut commands: Commands, assets: Res<AssetLoader>) {
Statue,
SpriteSheetBundle {
texture_atlas: assets.images.statue.clone(),
sprite: TextureAtlasSprite::new(0),
sprite: TextureAtlas::new(0),
transform: Transform::from_translation(Vec3::new(50., 100., 0.)),
..Default::default()
},