add selection cut button and binding
This commit is contained in:
parent
11fd29c9c6
commit
997297ab68
4 changed files with 31 additions and 8 deletions
|
@ -11,20 +11,20 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
|
||||||
- comments
|
- comments
|
||||||
- editing
|
- editing
|
||||||
- add to all intro levels
|
- add to all intro levels
|
||||||
|
- UI layout engine
|
||||||
|
- global scale setting
|
||||||
- highlight regions with background colours
|
- highlight regions with background colours
|
||||||
- accessibility
|
- accessibility
|
||||||
- ui scaling
|
|
||||||
- background colour setting
|
- background colour setting
|
||||||
- hotkeys for everything (no mouse needed to play)
|
- hotkeys for everything (no mouse needed to play)
|
||||||
- font selection (probably a lot of work)
|
|
||||||
- more levels
|
- more levels
|
||||||
- footprint and bounding box stats (instead of area)
|
- footprint and bounding box stats (instead of area)
|
||||||
- scroll output bytes
|
- scroll output bytes
|
||||||
- cut selections, copy to system clipboard
|
|
||||||
- timestamps in solutions and blueprints
|
- timestamps in solutions and blueprints
|
||||||
- lock tile types for early levels to make it less overwhelming
|
- lock tile types for early levels to make it less overwhelming
|
||||||
- display tool variant more clearly (it's not obvious there are more states)
|
- display tool variant more clearly (it's not obvious there are more states)
|
||||||
- better text rendering
|
- better text rendering
|
||||||
|
- font selection (probably a lot of work)
|
||||||
### online stuff
|
### online stuff
|
||||||
- store scores in server
|
- store scores in server
|
||||||
- validate solutions in server (with limits)
|
- validate solutions in server (with limits)
|
||||||
|
|
BIN
assets/cut.png
Normal file
BIN
assets/cut.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
|
@ -1036,8 +1036,31 @@ impl Editor {
|
||||||
draw_scaled_texture(d, globals.get_tex("save"), 148, y + 4, 2.);
|
draw_scaled_texture(d, globals.get_tex("save"), 148, y + 4, 2.);
|
||||||
|
|
||||||
self.tooltip.add(188, y, 40, 40, "Copy");
|
self.tooltip.add(188, y, 40, 40, "Copy");
|
||||||
|
let mut copy_selection = false;
|
||||||
if simple_button((d, &self.mouse), 188, y, 40, 40) || globals.is_pressed(ActionId::Copy)
|
if simple_button((d, &self.mouse), 188, y, 40, 40) || globals.is_pressed(ActionId::Copy)
|
||||||
{
|
{
|
||||||
|
copy_selection = true;
|
||||||
|
}
|
||||||
|
draw_scaled_texture(d, globals.get_tex("copy"), 192, y + 4, 2.);
|
||||||
|
|
||||||
|
self.tooltip.add(232, y, 40, 40, "Cut");
|
||||||
|
let mut erase_selection = false;
|
||||||
|
if simple_button((d, &self.mouse), 232, y, 40, 40) || globals.is_pressed(ActionId::Cut)
|
||||||
|
{
|
||||||
|
copy_selection = true;
|
||||||
|
erase_selection = true;
|
||||||
|
}
|
||||||
|
draw_scaled_texture(d, globals.get_tex("cut"), 236, y + 4, 2.);
|
||||||
|
|
||||||
|
self.tooltip.add(276, y, 40, 40, "Delete");
|
||||||
|
if simple_button((d, &self.mouse), 276, y, 40, 40)
|
||||||
|
|| globals.is_pressed(ActionId::Erase)
|
||||||
|
{
|
||||||
|
erase_selection = true;
|
||||||
|
}
|
||||||
|
draw_scaled_texture(d, globals.get_tex("eraser"), 280, y + 4, 2.);
|
||||||
|
|
||||||
|
if copy_selection {
|
||||||
let board = self.get_selected_as_board(selection);
|
let board = self.get_selected_as_board(selection);
|
||||||
if let Some(clipboard) = &mut globals.clipboard {
|
if let Some(clipboard) = &mut globals.clipboard {
|
||||||
clipboard
|
clipboard
|
||||||
|
@ -1047,10 +1070,7 @@ impl Editor {
|
||||||
self.pasting_board = Some(board);
|
self.pasting_board = Some(board);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draw_scaled_texture(d, globals.get_tex("copy"), 192, y + 4, 2.);
|
if erase_selection {
|
||||||
|
|
||||||
self.tooltip.add(232, y, 40, 40, "Delete");
|
|
||||||
if simple_button((d, &self.mouse), 232, y, 40, 40) {
|
|
||||||
let min = selection.0.min(selection.1);
|
let min = selection.0.min(selection.1);
|
||||||
let max = selection.0.max(selection.1);
|
let max = selection.0.max(selection.1);
|
||||||
let board = Board::new(Grid::new_empty(
|
let board = Board::new(Grid::new_empty(
|
||||||
|
@ -1059,7 +1079,6 @@ impl Editor {
|
||||||
));
|
));
|
||||||
self.set_area(min, board);
|
self.set_area(min, board);
|
||||||
}
|
}
|
||||||
draw_scaled_texture(d, globals.get_tex("eraser"), 236, y + 4, 2.);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut tool_button = |(row, col): (i32, i32),
|
let mut tool_button = |(row, col): (i32, i32),
|
||||||
|
|
|
@ -21,7 +21,9 @@ pub enum ActionId {
|
||||||
Undo,
|
Undo,
|
||||||
Redo,
|
Redo,
|
||||||
Copy,
|
Copy,
|
||||||
|
Cut,
|
||||||
Paste,
|
Paste,
|
||||||
|
Erase,
|
||||||
ToggleMenu,
|
ToggleMenu,
|
||||||
StartSim,
|
StartSim,
|
||||||
StopSim,
|
StopSim,
|
||||||
|
@ -59,7 +61,9 @@ impl Default for Input {
|
||||||
bind_key(ActionId::Redo, vec![LCtrl], Y);
|
bind_key(ActionId::Redo, vec![LCtrl], Y);
|
||||||
bind_key(ActionId::Redo, vec![LCtrl, LShift], Z);
|
bind_key(ActionId::Redo, vec![LCtrl, LShift], Z);
|
||||||
bind_key(ActionId::Copy, vec![LCtrl], C);
|
bind_key(ActionId::Copy, vec![LCtrl], C);
|
||||||
|
bind_key(ActionId::Cut, vec![LCtrl], X);
|
||||||
bind_key(ActionId::Paste, vec![LCtrl], V);
|
bind_key(ActionId::Paste, vec![LCtrl], V);
|
||||||
|
bind_key(ActionId::Erase, vec![], Backspace);
|
||||||
bind_key(ActionId::ToggleMenu, vec![], Escape);
|
bind_key(ActionId::ToggleMenu, vec![], Escape);
|
||||||
bind_key(ActionId::StartSim, vec![], Enter);
|
bind_key(ActionId::StartSim, vec![], Enter);
|
||||||
bind_key(ActionId::StopSim, vec![], Enter);
|
bind_key(ActionId::StopSim, vec![], Enter);
|
||||||
|
|
Loading…
Add table
Reference in a new issue