aboutsummaryrefslogtreecommitdiff
path: root/src/system.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/system.rs')
-rw-r--r--src/system.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/system.rs b/src/system.rs
new file mode 100644
index 0000000..7df8af8
--- /dev/null
+++ b/src/system.rs
@@ -0,0 +1,31 @@
+use crate::actor::{Actorful, Slot, Type};
+use crate::number::Number;
+
+pub struct System {
+ pub screen_buffer: Vec<u32>,
+}
+
+impl Actorful for System {
+ fn inputs() -> Vec<Slot> {
+ let nonnegative_int = Type::NumberInRange {
+ min: Some(Number::from(0)),
+ max: None,
+ };
+ let screen_position_type = Type::Record {
+ name: "Screen Position".to_string(),
+ fields: vec![
+ Slot { name: "X".to_string(), r#type: nonnegative_int.clone() },
+ Slot { name: "Y".to_string(), r#type: nonnegative_int },
+ ],
+ };
+ vec![Slot { name: "mouse_position".to_string(), r#type: screen_position_type }]
+ }
+
+ fn outputs() -> Vec<Slot> {
+ let u24 = Type::NumberInRange {
+ min: Some(Number::from(0)),
+ max: Some(Number::from(1 << 24 - 1)),
+ };
+ vec![Slot { name: "screen_buffer".to_string(), r#type: Type::List { contents: Box::new(u24) }}]
+ }
+}