diff --git a/Cargo.lock b/Cargo.lock index e387f5b..751b339 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2217,6 +2217,7 @@ dependencies = [ "bevy", "bevy_editor_pls", "bevy_rapier2d", + "readformat", ] [[package]] @@ -3887,6 +3888,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" +[[package]] +name = "readformat" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03f7fbd470aa8b3ad163c85cce8bccfc11cc9c44ef12da0a4eddd98bd307352" + [[package]] name = "rectangle-pack" version = "0.4.2" diff --git a/Cargo.toml b/Cargo.toml index a835352..9eaeca2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" bevy = { version = "0.14.2" } bevy_rapier2d = "0.27.0" bevy_editor_pls = "0.10" +readformat = "0.1.2" # Enable a small amount of optimization in the dev profile. [profile.dev] diff --git a/assets/test.png b/assets/test.png new file mode 100644 index 0000000..b199dbb Binary files /dev/null and b/assets/test.png differ diff --git a/assets/world.txt b/assets/world.txt new file mode 100644 index 0000000..b4b7a73 --- /dev/null +++ b/assets/world.txt @@ -0,0 +1,3 @@ +info section + +world section diff --git a/src/game/player.rs b/src/game/player.rs index 63af670..6d11747 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -30,7 +30,7 @@ pub fn add_player( MaterialMesh2dBundle { mesh: meshes.add(Circle::new(20.)).into(), material: materials.add(asset_server.load("test.png")), - transform: Transform::from_xyz(100., 100., 0.), + transform: Transform::from_xyz(10., 10., 0.), ..default() }, )) diff --git a/src/game/scene.rs b/src/game/scene.rs index 4531e60..4786b79 100644 --- a/src/game/scene.rs +++ b/src/game/scene.rs @@ -1,10 +1,21 @@ +use std::fs; + use bevy::{core_pipeline::smaa::SmaaSpecializedRenderPipelines, prelude::*}; use bevy::{prelude::*, scene::ScenePlugin}; use bevy_editor_pls::EditorPlugin; use bevy_rapier2d::prelude::*; +use readformat::readf; use crate::AppState; pub(super) fn scene_plugin(app: &mut App) { app.add_plugins(EditorPlugin::default()); + // app.add_systems(, ) + app.add_systems(Startup, (import_text_world,)); +} + +pub(super) fn import_text_world(mut commands: Commands, assets: Res) { + let world_string = fs::read_to_string("assets/world.txt"); + let &[info_string, world_string] = readf("info section\n{}\nworld section\n{}", world_string); + println!() }