Expand description
§Kon Engine
A modular 2D game engine for Rust, built with a focus on ECS performance and simplicity.
§Example
ⓘ
use kon::prelude::*;
#[component]
struct Position { x: f32, y: f32 }
#[system]
fn setup(ctx: &mut Context) {
ctx.world()
.spawn()
.insert(Position { x: 0.0, y: 0.0 })
.tag("player")
.id();
}
#[system]
fn update(ctx: &mut Context) {
if ctx.input().just_key_pressed(KeyCode::Escape) {
ctx.quit();
}
ctx.on::<WindowCloseRequested>(|_, context| {
context.quit();
});
}
fn main() {
Kon::new()
.add_plugin(DefaultPlugins)
.add_startup_system(setup)
.add_system(update)
.run();
}Re-exports§
pub use kon_core;pub use kon_ecs;pub use kon_window;pub use kon_input;pub use log;
Modules§
- prelude
- Common imports for Kon Engine
Structs§
- Default
Plugins - Default plugins bundle
Constants§
- VERSION
- Engine version