diff --git a/README.md b/README.md index 366d445..135de52 100644 --- a/README.md +++ b/README.md @@ -92,12 +92,12 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble ### intro, basic mechanics - output a zero (marble, io) - output multiple numbers in sequence (digits) -- output zeroes forever (looping, button, silo output) +- output zeroes forever (looping, trigger, bag output) - copy the input (input) - copy only odd input numbers (comparator, math, flipper) ### 0-terminated list processing - copy the second list -- calculate list length (math, silo input) +- calculate list length (math, bag input) - count instances of 5 in a list - reverse a list (bouncing) ### user-friendly numbers diff --git a/assets/tiles/bag_off.png b/assets/tiles/bag_off.png new file mode 100644 index 0000000..c270af5 Binary files /dev/null and b/assets/tiles/bag_off.png differ diff --git a/assets/tiles/bag_on.png b/assets/tiles/bag_on.png new file mode 100644 index 0000000..9630dab Binary files /dev/null and b/assets/tiles/bag_on.png differ diff --git a/assets/tiles/button_off.png b/assets/tiles/button_off.png deleted file mode 100644 index 9998e45..0000000 Binary files a/assets/tiles/button_off.png and /dev/null differ diff --git a/assets/tiles/button_on.png b/assets/tiles/button_on.png deleted file mode 100644 index ff8b8c6..0000000 Binary files a/assets/tiles/button_on.png and /dev/null differ diff --git a/assets/tiles/flipper_off.png b/assets/tiles/flipper_off.png index 8f5ee16..71c7983 100644 Binary files a/assets/tiles/flipper_off.png and b/assets/tiles/flipper_off.png differ diff --git a/assets/tiles/flipper_on.png b/assets/tiles/flipper_on.png index ae6038c..7da4ad9 100644 Binary files a/assets/tiles/flipper_on.png and b/assets/tiles/flipper_on.png differ diff --git a/assets/tiles/silo_off.png b/assets/tiles/silo_off.png deleted file mode 100644 index 27d9c13..0000000 Binary files a/assets/tiles/silo_off.png and /dev/null differ diff --git a/assets/tiles/silo_on.png b/assets/tiles/silo_on.png deleted file mode 100644 index d3c62de..0000000 Binary files a/assets/tiles/silo_on.png and /dev/null differ diff --git a/assets/tiles/trigger_off.png b/assets/tiles/trigger_off.png new file mode 100644 index 0000000..a818b72 Binary files /dev/null and b/assets/tiles/trigger_off.png differ diff --git a/assets/tiles/trigger_on.png b/assets/tiles/trigger_on.png new file mode 100644 index 0000000..f730800 Binary files /dev/null and b/assets/tiles/trigger_on.png differ diff --git a/assets/tiles/wire_cross_off.png b/assets/tiles/wire_cross_off.png index b511c34..3b582ca 100644 Binary files a/assets/tiles/wire_cross_off.png and b/assets/tiles/wire_cross_off.png differ diff --git a/assets/tiles/wire_cross_on.png b/assets/tiles/wire_cross_on.png index d79ca2c..c21ee12 100644 Binary files a/assets/tiles/wire_cross_on.png and b/assets/tiles/wire_cross_on.png differ diff --git a/assets/tiles/wire_horizontal_off.png b/assets/tiles/wire_horizontal_off.png index c0ac36e..b03fd94 100644 Binary files a/assets/tiles/wire_horizontal_off.png and b/assets/tiles/wire_horizontal_off.png differ diff --git a/assets/tiles/wire_horizontal_on.png b/assets/tiles/wire_horizontal_on.png index 3a96166..4c5f82d 100644 Binary files a/assets/tiles/wire_horizontal_on.png and b/assets/tiles/wire_horizontal_on.png differ diff --git a/assets/tiles/wire_vertical_off.png b/assets/tiles/wire_vertical_off.png index 4b81df0..7d060e4 100644 Binary files a/assets/tiles/wire_vertical_off.png and b/assets/tiles/wire_vertical_off.png differ diff --git a/assets/tiles/wire_vertical_on.png b/assets/tiles/wire_vertical_on.png index 59222fc..37d508c 100644 Binary files a/assets/tiles/wire_vertical_on.png and b/assets/tiles/wire_vertical_on.png differ diff --git a/src/editor.rs b/src/editor.rs index b09f011..a483f94 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -637,7 +637,7 @@ impl Editor { draw_usize(d, textures, self.machine.step_count(), 420, 4, 9, 2); draw_usize(d, textures, self.step_time as usize, 540, 42, 9, 1); - draw_usize(d, textures, self.max_step_time as usize, 540, 60, 9, 1); + draw_usize(d, textures, self.max_step_time as usize, 540, 58, 9, 1); d.draw_text("input:", 603, 8, 10, Color::WHITE); if simple_button(d, 600, 20, 35, 15) { @@ -786,8 +786,8 @@ impl Editor { if !hide_tile_tools { tool_button((0, 0), "block", Tool::SetTile(Tile::from_char('#'))); - tool_button((0, 1), "silo_off", Tool::SetTile(Tile::from_char('B'))); - tool_button((0, 2), "button_off", Tool::SetTile(Tile::from_char('*'))); + tool_button((0, 1), "bag_off", Tool::SetTile(Tile::from_char('B'))); + tool_button((0, 2), "trigger_off", Tool::SetTile(Tile::from_char('*'))); tool_button((0, 3), "io_tile_off", Tool::SetTile(Tile::from_char('I'))); tool_button((0, 4), "flipper_off", Tool::SetTile(Tile::from_char('F'))); tool_button((0, 5), "digit_tool", Tool::Digits(None)); diff --git a/src/marble_engine.rs b/src/marble_engine.rs index c682a91..25fc1e1 100644 --- a/src/marble_engine.rs +++ b/src/marble_engine.rs @@ -117,7 +117,7 @@ impl Machine { continue; } } - Some(Tile::Button(true)) => (), + Some(Tile::Trigger(true)) => (), _ => continue, } let Some(front_tile) = self.board.get_mut(front_pos) else { @@ -151,7 +151,7 @@ impl Machine { new_marbles.push((front_pos, value, dir)); } } - PTile::Silo => { + PTile::Bag => { if front_tile == &Tile::BLANK { new_marbles.push((front_pos, 0, dir)); } @@ -173,7 +173,7 @@ impl Machine { } } } - Some(Tile::Button(_state)) => (), + Some(Tile::Trigger(_state)) => (), Some(Tile::Wire(_, _state)) => (), _ => unreachable!(), }; @@ -202,7 +202,7 @@ impl Machine { // so they can figure out which directions they are powered from for &p in &self.powered { match self.board.get_mut(p) { - Some(Tile::Button(state)) => *state = false, + Some(Tile::Trigger(state)) => *state = false, Some(Tile::Wire(_, state)) => *state = false, _ => (), } @@ -298,7 +298,7 @@ impl Machine { let target_pos = match front_tile { Tile::Arrow(d) => d.step(front_pos), Tile::Mirror(m) => m.new_dir(dir).step(front_pos), - Tile::Button(_) => dir.step(front_pos), + Tile::Trigger(_) => dir.step(front_pos), _ => continue, }; let Some(target_tile) = self.board.get_mut(target_pos) else { @@ -319,6 +319,7 @@ impl Machine { } } + // let mut triggers_activated = Vec::new(); let mut removed_marbles = Vec::new(); // move marbles for (i, pos) in self.marbles[..old_marbles].iter_mut().enumerate() { @@ -356,7 +357,7 @@ impl Machine { } } else { let target_pos; - let mut is_button = false; + let mut is_trigger = false; let mut new_dir = dir; match front_tile { Tile::Arrow(d) => { @@ -367,11 +368,11 @@ impl Machine { new_dir = m.new_dir(dir); target_pos = new_dir.step(front_pos); } - Tile::Button(_) => { - is_button = true; + Tile::Trigger(_) => { + is_trigger = true; target_pos = dir.step(front_pos); } - Tile::Powerable(PTile::Silo, _) => { + Tile::Powerable(PTile::Bag, _) => { removed_marbles.push(i); continue; } @@ -387,7 +388,7 @@ impl Machine { }; if let Tile::Open(space_type, Claim::ClaimedIndirect) = target_tile { move_to(*space_type, target_pos, new_dir, &mut self.board); - if is_button { + if is_trigger { self.powered.push(front_pos); } } @@ -414,7 +415,7 @@ impl Machine { unreachable!() }; match tile { - Tile::Button(state) => { + Tile::Trigger(state) => { *state = true; for dir in Direction::ALL { let target_pos = dir.step(pos); @@ -470,7 +471,7 @@ impl Machine { continue; } } - Some(Tile::Button(true)) => (), + Some(Tile::Trigger(true)) => (), _ => continue, } let Some(front_tile) = self.board.get_mut(front_pos) else { diff --git a/src/marble_engine/tile.rs b/src/marble_engine/tile.rs index 03e98ed..8393793 100644 --- a/src/marble_engine/tile.rs +++ b/src/marble_engine/tile.rs @@ -9,7 +9,7 @@ pub enum Tile { Marble { value: MarbleValue, dir: Direction }, Mirror(MirrorType), Arrow(Direction), - Button(bool), + Trigger(bool), Wire(WireType, bool), Powerable(PTile, bool), } @@ -33,7 +33,7 @@ pub enum OpenTile { pub enum PTile { Gate(GateType), Math(MathOp), - Silo, + Bag, Flipper, IO, } @@ -84,7 +84,7 @@ impl Tile { value: 0, dir: Direction::Down, }, - '*' => Tile::Button(false), + '*' => Tile::Trigger(false), '-' => Tile::Wire(WireType::Horizontal, false), '|' => Tile::Wire(WireType::Vertical, false), '+' => Tile::Wire(WireType::Cross, false), @@ -105,7 +105,7 @@ impl Tile { 'M' => Tile::Powerable(PTile::Math(MathOp::Mul), false), 'D' => Tile::Powerable(PTile::Math(MathOp::Div), false), 'R' => Tile::Powerable(PTile::Math(MathOp::Rem), false), - 'B' => Tile::Powerable(PTile::Silo, false), + 'B' => Tile::Powerable(PTile::Bag, false), d @ '0'..='9' => Tile::Open(OpenTile::Digit(d as u8 - b'0'), Claim::Free), '#' => Tile::Block, _ => Tile::Open(OpenTile::Blank, Claim::Free), @@ -128,7 +128,7 @@ impl Tile { Direction::Left => '<', Direction::Right => '>', }, - Tile::Button(_) => '*', + Tile::Trigger(_) => '*', Tile::Wire(wire, _) => match wire { WireType::Vertical => '|', WireType::Horizontal => '-', @@ -148,7 +148,7 @@ impl Tile { MathOp::Div => 'D', MathOp::Rem => 'R', }, - PTile::Silo => 'B', + PTile::Bag => 'B', PTile::Flipper => 'F', PTile::IO => 'I', }, @@ -175,11 +175,11 @@ impl Tile { Tile::Open(OpenTile::Digit(n), _) => return format!("tile_digit_{n}"), Tile::Mirror(mirror) => mirror.texture_name(), Tile::Arrow(dir) => dir.arrow_tile_texture_name(), - Tile::Button(state) => { + Tile::Trigger(state) => { if *state { - "button_on" + "trigger_on" } else { - "button_off" + "trigger_off" } } Tile::Wire(wire, state) => { @@ -193,7 +193,7 @@ impl Tile { let root = match tile { PTile::Gate(gate) => gate.texture_name(), PTile::Math(math_op) => math_op.texture_name(), - PTile::Silo => "silo", + PTile::Bag => "bag", PTile::Flipper => "flipper", PTile::IO => "io_tile", }; diff --git a/src/theme.rs b/src/theme.rs index 6d9cdc8..137ede1 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -3,10 +3,9 @@ use raylib::prelude::*; pub const BG_DARK: Color = gray(32); pub const BG_MEDIUM: Color = gray(48); pub const BG_LIGHT: Color = gray(64); -pub const BG_WIDGET: Color = gray(64); +pub const BG_WIDGET: Color = gray(96); pub const BG_WIDGET_ACTIVE: Color = rgb(80, 120, 180); pub const FG_MARBLE_VALUE: Color = rgb(255, 80, 40); -pub const FG_TOGGLE_ENABLED: Color = gray(200); pub const fn widget_bg(highlight: bool) -> Color { if highlight { diff --git a/src/util.rs b/src/util.rs index 98dd8cb..e0baf10 100644 --- a/src/util.rs +++ b/src/util.rs @@ -68,7 +68,7 @@ pub fn simple_toggle_button( y + margin, width - margin * 2, height - margin * 2, - FG_TOGGLE_ENABLED, + BG_DARK, ); } if hover && d.is_mouse_button_pressed(MouseButton::MOUSE_BUTTON_LEFT) {