beginning of world loader
This commit is contained in:
parent
1b53a5f15f
commit
4d848a3acb
6 changed files with 23 additions and 1 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -2217,6 +2217,7 @@ dependencies = [
|
||||||
"bevy",
|
"bevy",
|
||||||
"bevy_editor_pls",
|
"bevy_editor_pls",
|
||||||
"bevy_rapier2d",
|
"bevy_rapier2d",
|
||||||
|
"readformat",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3887,6 +3888,12 @@ version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "readformat"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b03f7fbd470aa8b3ad163c85cce8bccfc11cc9c44ef12da0a4eddd98bd307352"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rectangle-pack"
|
name = "rectangle-pack"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
|
|
|
@ -7,6 +7,7 @@ edition = "2021"
|
||||||
bevy = { version = "0.14.2" }
|
bevy = { version = "0.14.2" }
|
||||||
bevy_rapier2d = "0.27.0"
|
bevy_rapier2d = "0.27.0"
|
||||||
bevy_editor_pls = "0.10"
|
bevy_editor_pls = "0.10"
|
||||||
|
readformat = "0.1.2"
|
||||||
|
|
||||||
# Enable a small amount of optimization in the dev profile.
|
# Enable a small amount of optimization in the dev profile.
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
BIN
assets/test.png
Normal file
BIN
assets/test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
3
assets/world.txt
Normal file
3
assets/world.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
info section
|
||||||
|
|
||||||
|
world section
|
|
@ -30,7 +30,7 @@ pub fn add_player(
|
||||||
MaterialMesh2dBundle {
|
MaterialMesh2dBundle {
|
||||||
mesh: meshes.add(Circle::new(20.)).into(),
|
mesh: meshes.add(Circle::new(20.)).into(),
|
||||||
material: materials.add(asset_server.load("test.png")),
|
material: materials.add(asset_server.load("test.png")),
|
||||||
transform: Transform::from_xyz(100., 100., 0.),
|
transform: Transform::from_xyz(10., 10., 0.),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
use bevy::{core_pipeline::smaa::SmaaSpecializedRenderPipelines, prelude::*};
|
use bevy::{core_pipeline::smaa::SmaaSpecializedRenderPipelines, prelude::*};
|
||||||
use bevy::{prelude::*, scene::ScenePlugin};
|
use bevy::{prelude::*, scene::ScenePlugin};
|
||||||
use bevy_editor_pls::EditorPlugin;
|
use bevy_editor_pls::EditorPlugin;
|
||||||
use bevy_rapier2d::prelude::*;
|
use bevy_rapier2d::prelude::*;
|
||||||
|
use readformat::readf;
|
||||||
|
|
||||||
use crate::AppState;
|
use crate::AppState;
|
||||||
|
|
||||||
pub(super) fn scene_plugin(app: &mut App) {
|
pub(super) fn scene_plugin(app: &mut App) {
|
||||||
app.add_plugins(EditorPlugin::default());
|
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<AssetServer>) {
|
||||||
|
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!()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue