Penguin app is an appbuilder and abstraction layer for looping applications built on winit, legion ecs and fern logger. It also adds a bevy-like plugin implementation to legion.
The package also includes an optional feature adding a time resource plugin, enabling easy access to deltatime.
toml
[dependencies]
penguin-application = { version = "0.1" }
penguin-config = { version = "0.1" }
Create an app-config.json file like this and put in your project root directory. Available logger levels are ["error", "warning", "info", "debug", "trace"] in decending order of importance.
json
{
"logger_config": {
"output_path": "logs/output.log",
"debug_message_severity": "debug"
},
"window_config": {
"width": 640,
"height": 400
}
}
Log messages are generated with the standard log function calls, such as log::error!("message")
.
```rust use penguinconfig::PenguinConfig; use penguinapp::{App, config::AppConfig};
fn main() { App::builder(AppConfig::readconfig()) .addplugin(penguinapp::timeplugin::TimePlugin) .run() .unwrap(); } ```
```rust use penguinapp::ecs::*; use penguinapp::time_plugin::Time;
pub struct MeasureTimePlugin;
impl Plugin for MeasureTimePlugin {
fn startup(&mut self, resources: &mut Resources) -> Vec
fn run() -> Vec<Step> {
Schedule::builder()
.add_system(measure_time_system())
.build()
.into_vec()
}
fn shutdown() -> Vec<Step> {
vec![]
}
}
struct PassedTimeResource(f32);
fn measuretime(#[resource] passedtime: &mut PassedTimeResource, #[resource] time: &Time) { passedtime.0 += time.delta(); log::info!("Time passed: {}", passedtime.0); } ```