add ui buttons for undo/redo
This commit is contained in:
parent
656f567242
commit
64fb7ca5ba
6 changed files with 25 additions and 6 deletions
|
@ -4,6 +4,9 @@
|
||||||
logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
- accessibility
|
||||||
|
- background colour setting
|
||||||
|
- hotkeys for everything
|
||||||
- more levels
|
- more levels
|
||||||
- make direct power (comparator -> machine) work, (needs storing power direction in machine tiles)
|
- make direct power (comparator -> machine) work, (needs storing power direction in machine tiles)
|
||||||
- cut selections, copy to system clipboard
|
- cut selections, copy to system clipboard
|
||||||
|
|
BIN
assets/redo.png
Normal file
BIN
assets/redo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 186 B |
BIN
assets/redo_disabled.png
Normal file
BIN
assets/redo_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 181 B |
BIN
assets/undo.png
Normal file
BIN
assets/undo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 B |
BIN
assets/undo_disabled.png
Normal file
BIN
assets/undo_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 B |
|
@ -644,11 +644,7 @@ impl Editor {
|
||||||
if simple_button(d, 85, 5, 60, 30) {
|
if simple_button(d, 85, 5, 60, 30) {
|
||||||
self.exit_state = ExitState::ExitAndSave;
|
self.exit_state = ExitState::ExitAndSave;
|
||||||
}
|
}
|
||||||
d.draw_text("save", 90, 10, 20, Color::WHITE);
|
d.draw_text("exit", 90, 10, 20, Color::WHITE);
|
||||||
if simple_button(d, 150, 5, 80, 30) {
|
|
||||||
self.exit_state = ExitState::ExitNoSave;
|
|
||||||
}
|
|
||||||
d.draw_text("revert", 155, 10, 20, Color::WHITE);
|
|
||||||
} else {
|
} else {
|
||||||
if simple_button(d, 5, 5, 75, 30) {
|
if simple_button(d, 5, 5, 75, 30) {
|
||||||
self.exit_menu = true;
|
self.exit_menu = true;
|
||||||
|
@ -660,7 +656,27 @@ impl Editor {
|
||||||
d.draw_text("save", 90, 10, 20, Color::WHITE);
|
d.draw_text("save", 90, 10, 20, Color::WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
simple_toggle_button(d, &mut self.draw_overlay, 235, 4, 20, 32, 4);
|
if simple_button(d, 150, 4, 32, 32) {
|
||||||
|
self.undo()
|
||||||
|
}
|
||||||
|
let undo_icon = if self.undo_index > 0 {
|
||||||
|
"undo"
|
||||||
|
} else {
|
||||||
|
"undo_disabled"
|
||||||
|
};
|
||||||
|
draw_scaled_texture(d, textures.get(undo_icon), 150, 4, 2.);
|
||||||
|
|
||||||
|
if simple_button(d, 186, 4, 32, 32) {
|
||||||
|
self.redo()
|
||||||
|
}
|
||||||
|
let redo_icon = if self.undo_index < self.undo_history.len() {
|
||||||
|
"redo"
|
||||||
|
} else {
|
||||||
|
"redo_disabled"
|
||||||
|
};
|
||||||
|
draw_scaled_texture(d, textures.get(redo_icon), 186, 4, 2.);
|
||||||
|
|
||||||
|
simple_toggle_button(d, &mut self.draw_overlay, 223, 4, 32, 32, 4);
|
||||||
|
|
||||||
match self.sim_state {
|
match self.sim_state {
|
||||||
SimState::Editing => {
|
SimState::Editing => {
|
||||||
|
|
Loading…
Reference in a new issue