forked from feather-rs/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem.rs
More file actions
23 lines (20 loc) · 717 Bytes
/
Copy pathsystem.rs
File metadata and controls
23 lines (20 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! Defines types for registering systems and event handlers.
use crate::event::{EventId, OpaqueEvent};
use crate::states::GameState;
/// Specifies a description of a system.
#[repr(C)]
pub struct SystemSpec {
/// A pointer to the function to run when the system is invoked.
pub f: fn(*mut GameState),
}
/// Specifies a description of an event handler.
#[repr(C)]
pub struct HandlerSpec {
/// The function to invoke when the handler runs.
///
/// The function may assume the `OpaqueEvent` pointer
/// points to the event type associated with `event`.
pub f: fn(*mut GameState, *mut OpaqueEvent),
/// The ID of the event type which is to be handled by `f`.
pub event: EventId,
}