haw-gj13-game/src/game/scene.rs

33 lines
941 B
Rust
Raw Normal View History

2024-11-23 17:09:42 +01:00
use std::fs;
2024-11-23 16:24:16 +01:00
use bevy::{core_pipeline::smaa::SmaaSpecializedRenderPipelines, prelude::*};
2024-11-23 16:13:54 +01:00
use bevy::{prelude::*, scene::ScenePlugin};
use bevy_editor_pls::EditorPlugin;
2024-11-22 22:39:00 +01:00
use bevy_rapier2d::prelude::*;
2024-11-23 17:09:42 +01:00
use readformat::readf;
2024-11-22 22:39:00 +01:00
2024-11-23 01:40:50 +01:00
use crate::AppState;
2024-11-22 22:39:00 +01:00
pub(super) fn scene_plugin(app: &mut App) {
2024-11-23 16:13:54 +01:00
app.add_plugins(EditorPlugin::default());
2024-11-23 17:09:42 +01:00
// app.add_systems(, )
app.add_systems(Startup, (import_text_world,));
}
2024-11-23 17:15:27 +01:00
pub struct WorldInfo {
block_size: f32,
}
2024-11-23 17:09:42 +01:00
pub(super) fn import_text_world(mut commands: Commands, assets: Res<AssetServer>) {
2024-11-23 17:15:27 +01:00
let world_string = fs::read_to_string("assets/world.txt").expect("need a world to load");
let [info_string, world_string] = &readf("info section\n{}\nworld section\n{}", &world_string)
.expect("world does not have sections")[..]
else {
panic!("world does not have sections");
};
for line in info_string.lines() {
readf("{} = {}", &line);
}
2024-11-22 22:39:00 +01:00
}