4 releases
Uses old Rust 2015
0.4.3 | Mar 22, 2019 |
---|---|
0.4.2 | Mar 22, 2019 |
0.4.1 | Mar 15, 2019 |
0.4.0 | Mar 7, 2019 |
#1389 in Game dev
1MB
2K
SLoC
Krust 0.4.3
Setting up
Firstly include the krust_core crate:
extern crate krust_core;
pub use krust_core;
Next, initialise the engine:
let mut krust = Krust::new();
Now call start on the engine passing a boxed scene:
krust.start(Box::new(GameScene::new()));
Creating a Scene
In order to create a scene you need a struct that implements the 'scene' trait like so:
struct KirovScene {
krust: *mut Krust,
il_index: i32,
}
impl scene::Scene for KirovScene {
type Renderer = graphics::Renderer;
type Krust = Krust;
fn init(&mut self, krust: *mut Krust){
}
fn update(&mut self) {
}
fn render(&mut self, r: &mut graphics::Renderer) {
}
unsafe fn delete(&mut self) {
}
}
The functions: 'init', 'update', 'render' and 'delete' are required.
Dependencies
~41MB
~666K SLoC