specify default input/output text/byte mode per level

This commit is contained in:
Crispy 2024-10-07 17:33:53 +02:00
parent e9b03b937b
commit 70d7256e9d
4 changed files with 17 additions and 5 deletions

View file

@ -89,8 +89,8 @@ impl Editor {
view_offset: Vector2::zero(),
zoom: 1,
active_tool: Tool::None,
output_as_text: false,
input_as_text: false,
output_as_text: level.output_is_text(),
input_as_text: level.input_is_text(),
input_text_selected: false,
sim_speed: 8,
time_since_step: 0.,

View file

@ -11,6 +11,10 @@ pub struct Level {
init_board: Option<String>,
inputs: Vec<u8>,
outputs: Vec<u8>,
#[serde(default)]
input_is_text: bool,
#[serde(default)]
output_is_text: bool,
}
impl Level {
@ -45,4 +49,12 @@ impl Level {
pub fn outputs(&self) -> &[u8] {
&self.outputs
}
pub fn input_is_text(&self) -> bool {
self.input_is_text
}
pub fn output_is_text(&self) -> bool {
self.output_is_text
}
}