more tile buttons

This commit is contained in:
Crispy 2024-10-05 15:56:33 +02:00
parent a0f11b60fb
commit 12a8544645
6 changed files with 18 additions and 11 deletions

View file

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View file

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View file

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View file

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

View file

@ -80,14 +80,13 @@ fn main() {
let mut d = rl.begin_drawing(&thread);
d.clear_background(Color::new(64, 64, 64, 255));
game.gui(&mut d, &textures);
d.draw_fps(2, 2);
}
}
impl Game {
fn new_sandbox() -> Self {
Self {
source_board: Board::new_empty(1, 1),
source_board: Board::new_empty(16, 16),
machine: Machine::new_empty(1),
sim_state: SimState::Editing,
view_offset: Vector2::zero(),
@ -174,7 +173,7 @@ impl Game {
self.draw_board(d, textures);
let height = d.get_screen_height();
let footer_height = 100;
let footer_height = 95;
let footer_top = (height - footer_height) as f32;
d.draw_rectangle(
0,
@ -228,7 +227,7 @@ impl Game {
texture_button(
d,
Vector2 {
x: 300. + col as f32 * bound_offset,
x: 300. + col as f32 * bound_offset - if col < 0 { 15. } else { 0. },
y: footer_top + 5. + row as f32 * bound_offset,
},
textures.get(texture),
@ -241,9 +240,13 @@ impl Game {
tool_button((0, -1), "eraser", Tool::SetTile(tile_to_char(' ')));
tool_button((1, -1), "", Tool::None);
tool_button((0, 0), "block", Tool::SetTile(tile_to_char('#')));
tool_button((0, 1), "bag_off", Tool::SetTile(tile_to_char('B')));
tool_button((0, 2), "trigger_off", Tool::SetTile(tile_to_char('*')));
tool_button((0, 0), "marble", Tool::SetTile(tile_to_char('o')));
tool_button((0, 1), "block", Tool::SetTile(tile_to_char('#')));
tool_button((0, 2), "bag_off", Tool::SetTile(tile_to_char('B')));
tool_button((0, 3), "trigger_off", Tool::SetTile(tile_to_char('*')));
tool_button((0, 4), "input_off", Tool::SetTile(tile_to_char('I')));
tool_button((0, 5), "output_off", Tool::SetTile(tile_to_char('P')));
tool_button((0, 6), "flipper_off", Tool::SetTile(tile_to_char('F')));
tool_button(
(1, 0),
@ -256,6 +259,10 @@ impl Game {
Tool::SetTile(tile_to_char('|')),
);
tool_button((1, 2), "wire_cross_off", Tool::SetTile(tile_to_char('+')));
tool_button((1, 3), "arrow_up", Tool::SetTile(tile_to_char('^')));
tool_button((1, 4), "arrow_down", Tool::SetTile(tile_to_char('v')));
tool_button((1, 5), "arrow_left", Tool::SetTile(tile_to_char('<')));
tool_button((1, 6), "arrow_right", Tool::SetTile(tile_to_char('>')));
let mouse_pos = d.get_mouse_position();
if self.sim_state == SimState::Editing && mouse_pos.y < footer_top {

View file

@ -103,10 +103,10 @@ impl Tile {
MirrorType::Back => "mirror_back",
},
Tile::Arrow(dir) => match dir {
Direction::Up => "up",
Direction::Down => "down",
Direction::Left => "left",
Direction::Right => "right",
Direction::Up => "arrow_up",
Direction::Down => "arrow_down",
Direction::Left => "arrow_left",
Direction::Right => "arrow_right",
},
Tile::Powerable(tile, state) => {
let root = match tile {