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
48
49
50
//! # Plugins
//! This crate provides a simple trait for creating plugins within the Fennel engine.
//! Plugins allow to extend the capabilities of the engine, and also are an essential piece of it,
//! as plugins are the backbone for most of the engine's features.
//!
//! An example is the `fennel_core::plugin::GraphicsPlugin` plugin, which provides the most important
//! part of the engine, the graphics.
use HashMap;
use ;
use AtomicRefCell;
/// A trait that all plugins must implement in order to be inserted into `App`
///
/// # Example
/// ```
/// use specs::World;
/// use fennel_plugins::Plugin;
/// struct MyCoolPlugin;
///
/// impl Plugin for MyCoolPlugin {
/// fn prepare(&mut self, _world: *mut World) -> anyhow::Result<()> {
/// // initialize your plugin here
/// Ok(())
/// }
///
/// fn update(&mut self, delta_time: f64) -> anyhow::Result<()> {
/// // update your plugin state
/// Ok(())
/// }
///
/// fn name(&self) -> &'static str {
/// "my_cool_plugin"
/// }
/// }
/// ```