show more output cells when space is available
This commit is contained in:
parent
098dc9517d
commit
0ca1b4ba54
2 changed files with 14 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::ops::Rem;
|
||||
use std::{mem::transmute, ops::Rem};
|
||||
|
||||
use raylib::prelude::*;
|
||||
|
||||
|
@ -404,7 +404,7 @@ impl Editor {
|
|||
texture_option_button(
|
||||
d,
|
||||
Vector2 {
|
||||
x: 320. + col as f32 * bound_offset - if col < 0 { 15. } else { 0. },
|
||||
x: 100. + col as f32 * bound_offset - if col < 0 { 10. } else { 0. },
|
||||
y: footer_top + 5. + row as f32 * bound_offset,
|
||||
},
|
||||
textures.get(texture),
|
||||
|
@ -453,8 +453,12 @@ impl Editor {
|
|||
Tool::Gate,
|
||||
);
|
||||
|
||||
let output_x = 370;
|
||||
let output_cell_width = 43;
|
||||
let output_cells = (d.get_screen_width() - output_x) as usize / 43;
|
||||
|
||||
let y = footer_top as i32 + 5;
|
||||
if simple_button(d, 600, y + 70, 65, 15) {
|
||||
if simple_button(d, output_x, y + 70, 65, 15) {
|
||||
self.output_as_text = !self.output_as_text
|
||||
}
|
||||
let output_mode_text = if self.output_as_text {
|
||||
|
@ -462,11 +466,12 @@ impl Editor {
|
|||
} else {
|
||||
"show text"
|
||||
};
|
||||
d.draw_text(output_mode_text, 605, y + 72, 10, Color::WHITE);
|
||||
let output_start = self.machine.output().len().saturating_sub(8);
|
||||
let output_end = output_start + 8;
|
||||
d.draw_text(output_mode_text, output_x + 5, y + 72, 10, Color::WHITE);
|
||||
|
||||
let output_start = self.machine.output().len().saturating_sub(output_cells);
|
||||
let output_end = output_start + output_cells;
|
||||
for (box_index, index) in (output_start..output_end).enumerate() {
|
||||
let x = 600 + 43 * box_index as i32;
|
||||
let x = output_x + output_cell_width * box_index as i32;
|
||||
|
||||
let expected_byte = self.level.outputs().get(index);
|
||||
let real_byte = self.machine.output().get(index);
|
||||
|
@ -534,9 +539,7 @@ impl Editor {
|
|||
}
|
||||
let pos = *pos;
|
||||
for n in 0..10 {
|
||||
if d.is_key_pressed(unsafe {
|
||||
std::mem::transmute(KeyboardKey::KEY_ZERO as u32 + n)
|
||||
}) {
|
||||
if d.is_key_pressed(unsafe { transmute::<u32, KeyboardKey>(b'0' as u32 + n) }) {
|
||||
self.set_tile(pos, Tile::Digit(n as u8));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ impl Board {
|
|||
if self.in_bounds((tx, ty).into()) {
|
||||
let tile = self.rows[ty][tx];
|
||||
let texname = tile.texture();
|
||||
if texname == "" {
|
||||
if texname.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let texture = textures.get(&texname);
|
||||
|
|
Loading…
Reference in a new issue