WIP upgrade
This commit is contained in:
parent
5db15f5bc0
commit
f36c4eb528
|
@ -1,4 +1,3 @@
|
||||||
[target.x86_64-unknown-linux-gnu]
|
[target.x86_64-unknown-linux-gnu]
|
||||||
linker = "clang"
|
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
1869
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[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"] }
|
# bevy = { version = "0.12.1", features = ["wayland", "file_watcher", "trace"] }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705856552,
|
"lastModified": 1715787315,
|
||||||
"narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=",
|
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d",
|
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -9,8 +9,8 @@ pub struct AssetLoader {
|
||||||
|
|
||||||
#[derive(Resource, Debug, Default)]
|
#[derive(Resource, Debug, Default)]
|
||||||
pub struct Sprites {
|
pub struct Sprites {
|
||||||
pub player: Handle<TextureAtlas>,
|
pub player: Handle<TextureAtlasLayout>,
|
||||||
pub statue: Handle<TextureAtlas>,
|
pub statue: Handle<TextureAtlasLayout>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource, Debug, Default)]
|
#[derive(Resource, Debug, Default)]
|
||||||
|
@ -35,7 +35,7 @@ impl Plugin for AssetPlugin {
|
||||||
fn load_assets(
|
fn load_assets(
|
||||||
mut assets: ResMut<AssetLoader>,
|
mut assets: ResMut<AssetLoader>,
|
||||||
asset_server: Res<AssetServer>,
|
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 player_img = asset_server.load("img/Player.png");
|
||||||
let props_img = asset_server.load("img/Props.png");
|
let props_img = asset_server.load("img/Props.png");
|
||||||
|
|
|
@ -25,8 +25,8 @@ fn spawn_player(mut commands: Commands, assets: Res<AssetLoader>) {
|
||||||
.spawn((
|
.spawn((
|
||||||
Player,
|
Player,
|
||||||
SpriteSheetBundle {
|
SpriteSheetBundle {
|
||||||
texture_atlas: assets.images.player.clone(),
|
atlas: assets.images.player.clone().into(),
|
||||||
sprite: TextureAtlasSprite::new(0),
|
sprite: TextureAtlas::new(0),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Mover {
|
Mover {
|
||||||
|
@ -42,9 +42,9 @@ fn spawn_player(mut commands: Commands, assets: Res<AssetLoader>) {
|
||||||
|
|
||||||
fn controls(
|
fn controls(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
mut query: Query<(&mut TextureAtlasSprite, &mut Heading, Entity), With<Player>>,
|
mut query: Query<(&mut TextureAtlas, &mut Heading, Entity), With<Player>>,
|
||||||
input: Res<Input<KeyCode>>,
|
input: Res<ButtonInput<KeyCode>>,
|
||||||
mouse_input: Res<Input<MouseButton>>,
|
mouse_input: Res<ButtonInput<MouseButton>>,
|
||||||
assets: Res<AssetLoader>,
|
assets: Res<AssetLoader>,
|
||||||
q_windows: Query<&Window, With<PrimaryWindow>>,
|
q_windows: Query<&Window, With<PrimaryWindow>>,
|
||||||
q_camera: Query<(&Camera, &GlobalTransform), With<Camera>>,
|
q_camera: Query<(&Camera, &GlobalTransform), With<Camera>>,
|
||||||
|
@ -65,8 +65,8 @@ fn controls(
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
Statue,
|
Statue,
|
||||||
SpriteSheetBundle {
|
SpriteSheetBundle {
|
||||||
texture_atlas: assets.images.statue.clone(),
|
atlas: assets.images.statue.clone(),
|
||||||
sprite: TextureAtlasSprite::new(0),
|
sprite: TextureAtlas::new(0),
|
||||||
transform: Transform::from_translation(spos),
|
transform: Transform::from_translation(spos),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
@ -118,14 +118,14 @@ fn controls(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sprite_select(
|
fn sprite_select(
|
||||||
mut query: Query<(&Handle<TextureAtlas>, &mut TextureAtlasSprite), With<Player>>,
|
mut query: Query<(&Handle<TextureAtlasLayout>, &mut TextureAtlas), With<Player>>,
|
||||||
keyboard_input: Res<Input<KeyCode>>,
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
|
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) {
|
if keyboard_input.pressed(KeyCode::Escape) {
|
||||||
app_exit_events.send(bevy::app::AppExit);
|
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 (texture, mut sprite) = query.single_mut();
|
||||||
let t = texture_atlases
|
let t = texture_atlases
|
||||||
.get(texture)
|
.get(texture)
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn spawn_statue(mut commands: Commands, assets: Res<AssetLoader>) {
|
||||||
Statue,
|
Statue,
|
||||||
SpriteSheetBundle {
|
SpriteSheetBundle {
|
||||||
texture_atlas: assets.images.statue.clone(),
|
texture_atlas: assets.images.statue.clone(),
|
||||||
sprite: TextureAtlasSprite::new(0),
|
sprite: TextureAtlas::new(0),
|
||||||
transform: Transform::from_translation(Vec3::new(50., 50., 0.)),
|
transform: Transform::from_translation(Vec3::new(50., 50., 0.)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,7 @@ fn spawn_statue(mut commands: Commands, assets: Res<AssetLoader>) {
|
||||||
Statue,
|
Statue,
|
||||||
SpriteSheetBundle {
|
SpriteSheetBundle {
|
||||||
texture_atlas: assets.images.statue.clone(),
|
texture_atlas: assets.images.statue.clone(),
|
||||||
sprite: TextureAtlasSprite::new(0),
|
sprite: TextureAtlas::new(0),
|
||||||
transform: Transform::from_translation(Vec3::new(50., 100., 0.)),
|
transform: Transform::from_translation(Vec3::new(50., 100., 0.)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue