summaryrefslogtreecommitdiff
path: root/src/input_layout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_layout.rs')
-rw-r--r--src/input_layout.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/input_layout.rs b/src/input_layout.rs
new file mode 100644
index 0000000..2b086a3
--- /dev/null
+++ b/src/input_layout.rs
@@ -0,0 +1,25 @@
+use crate::gate::*;
+use macroquad::prelude::*;
+
+pub struct InputLayout {
+ inputs: Vec<Connection>,
+}
+
+impl InputLayout {
+ pub fn new(inputs: Vec<Connection>) -> Self {
+ InputLayout { inputs }
+ }
+ pub fn draw(&self) {
+ let playground_offset_x: f32 = screen_width() / 20.;
+ let playground_offset_y: f32 = screen_height() / 14.;
+ let playground_height: f32 = screen_height() - playground_offset_y * 2.0;
+ for (cnt, node) in self.inputs.iter().enumerate() {
+ draw_circle(
+ playground_offset_x,
+ playground_height / 3.0 + 25. + (30. * cnt as f32),
+ node.radius,
+ if node.on { node.color } else { GRAY },
+ );
+ }
+ }
+}