pub struct App { /* private fields */ }Expand description
Main application struct that manages the game loop and plugin lifecycle
The App coordinates:
- Plugin registration and initialization
- System scheduling (startup and per-frame)
- Main loop execution
- Resource cleanup on shutdown
§Example
ⓘ
use kon::prelude::*;
fn main() {
Kon::new()
.add_plugin(DefaultPlugins)
.add_startup_system(setup)
.add_system(update)
.run();Implementations§
Source§impl App
impl App
Sourcepub fn new() -> App
pub fn new() -> App
Creates a new App instance
Initializes logging and installs custom panic handler
Sourcepub fn add_plugin<P>(&mut self, plugin: P) -> &mut Appwhere
P: Plugin,
pub fn add_plugin<P>(&mut self, plugin: P) -> &mut Appwhere
P: Plugin,
Adds a plugin to the application
Plugins extend engine functionality. Common examples:
EcsPlugin- Registers the WorldWindowPlugin- Creates the game windowDefaultPlugins- Bundle of core plugins
§Returns
Self reference for method chaining
Sourcepub fn add_startup_system<F>(&mut self, system: F) -> &mut App
pub fn add_startup_system<F>(&mut self, system: F) -> &mut App
Adds a startup system that runs once at application start
§Returns
Self reference for method chaining
Sourcepub fn add_system<F>(&mut self, system: F) -> &mut App
pub fn add_system<F>(&mut self, system: F) -> &mut App
Sourcepub fn register<R>(&mut self, resource: R) -> &mut App
pub fn register<R>(&mut self, resource: R) -> &mut App
Registers a global resource accessible from all systems
Resources are stored in Context and accessible via ctx.global::<T>().
§Returns
Self reference for method chaining
Sourcepub fn context_mut(&mut self) -> &mut Context
pub fn context_mut(&mut self) -> &mut Context
Returns a mutable reference to the engine context
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl !UnwindSafe for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more