-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello_world.rs
47 lines (41 loc) · 1.21 KB
/
hello_world.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use ie::prelude::*;
/** Returns the window config */
pub fn window_conf() -> Conf {
return Conf {
window_title: "Hello IE!".into(),
window_width: 1280,
window_height: 720,
fullscreen: false,
..Default::default()
};
}
/** An example plugin */
pub struct HelloPlugin;
impl Plugin for HelloPlugin {
fn init(&mut self, _world: &mut World) -> IslandResult<()> {
info!("Hello, plugin!");
return Ok(());
}
fn update(&mut self, _world: &mut World) -> IslandResult<()> {
return Ok(());
}
fn render(&self, _world: &World) -> IslandResult<()> {
// Custom rendering using macroquad
draw_text("Hello, world!", -(1280.0 / 2.0), -(720.0 / 2.0) + 32.0, 32.0, GREEN);
return Ok(());
}
}
/** The macroquad entrypoint */
#[macroquad::main(window_conf)]
async fn main() -> IslandResult<()> {
// Set the world with the first loaded scene
ie::start(IEAppDescriptor {
first_scene: Some("examples/example_scene.json"),
assets_descriptor: Some("examples/assets.json"),
debug_mode: true,
plugins: vec![Box::new(HelloPlugin)],
..Default::default()
})
.await?;
return Ok(());
}