add key bindings for eraser, selection, blueprint list and 'none' tool
This commit is contained in:
parent
454c836b38
commit
44494f4d01
3 changed files with 36 additions and 22 deletions
|
@ -5,6 +5,7 @@ Game store page: https://crispypin.itch.io/marble-machinations
|
|||
### added
|
||||
- create "missing levels" section allowing access to solutions to levels that are no longer available
|
||||
- click to collapse chapters in level list
|
||||
- input bindings for eraser (X), selection (B), blueprint list (Ctrl B), no tool (no default binding)
|
||||
### fixed
|
||||
- When two input bindings had the same trigger but one has a strict subset of the others modifiers, both would activate when the one with more modifiers was pressed. For example (Ctrl+S -> Save) would also trigger (S -> Wire Tool). Now, Shift+S will still trigger Wire Tool, unless Shift+S (or eg. Shift+Ctrl+S) is bound to something else.
|
||||
|
||||
|
@ -16,7 +17,7 @@ Game store page: https://crispypin.itch.io/marble-machinations
|
|||
### added
|
||||
- score number: bounding area
|
||||
- configurable key bindings for many editor actions
|
||||
- QWERTY+ASDFGH keybindings for the tile tools by default
|
||||
- QWERTY+ASDFGH key bindings for the tile tools by default
|
||||
- OS clipboard copy/paste, with fallback to old behavior when copying
|
||||
- cut selection
|
||||
- in-grid text comments (not yet editable in-game)
|
||||
|
|
|
@ -1060,7 +1060,7 @@ impl Editor {
|
|||
|
||||
self.tooltip.add(276, y, 40, 40, "Delete");
|
||||
if simple_button((d, &self.mouse), 276, y, 40, 40)
|
||||
|| globals.is_pressed(ActionId::Erase)
|
||||
|| globals.is_pressed(ActionId::EraseSelection)
|
||||
{
|
||||
erase_selection = true;
|
||||
}
|
||||
|
@ -1091,7 +1091,7 @@ impl Editor {
|
|||
texture: &str,
|
||||
tooltip: &'static str,
|
||||
tool_option: Tool,
|
||||
action: Option<ActionId>| {
|
||||
action: ActionId| {
|
||||
let border = 4.;
|
||||
let gap = 2.;
|
||||
let button_size = 32. + border * 2.;
|
||||
|
@ -1111,20 +1111,26 @@ impl Editor {
|
|||
tool_option,
|
||||
&mut self.active_tool,
|
||||
border,
|
||||
action.map(|a| globals.is_pressed(a)).unwrap_or(false),
|
||||
globals.is_pressed(action),
|
||||
)
|
||||
};
|
||||
tool_button((0, -2), "eraser", "Eraser", Tool::Erase, None);
|
||||
tool_button((0, -2), "eraser", "Eraser", Tool::Erase, ActionId::Eraser);
|
||||
tool_button(
|
||||
(1, -2),
|
||||
"selection",
|
||||
"Select",
|
||||
Tool::SelectArea(Selection::default()),
|
||||
None,
|
||||
ActionId::Selection,
|
||||
);
|
||||
|
||||
tool_button((0, -1), "blueprint", "Blueprints", Tool::Blueprint, None);
|
||||
tool_button((1, -1), "transparent", "None", Tool::None, None);
|
||||
tool_button(
|
||||
(0, -1),
|
||||
"blueprint",
|
||||
"Blueprints",
|
||||
Tool::Blueprint,
|
||||
ActionId::Blueprints,
|
||||
);
|
||||
tool_button((1, -1), "transparent", "None", Tool::None, ActionId::NoTool);
|
||||
|
||||
if !hide_tile_tools {
|
||||
tool_button(
|
||||
|
@ -1132,42 +1138,42 @@ impl Editor {
|
|||
"block",
|
||||
"Block",
|
||||
Tool::SetTile(Tile::from_char('#')),
|
||||
Some(ActionId::TileBlock),
|
||||
ActionId::TileBlock,
|
||||
);
|
||||
tool_button(
|
||||
(0, 1),
|
||||
"silo_off",
|
||||
"Silo",
|
||||
Tool::SetTile(Tile::from_char('B')),
|
||||
Some(ActionId::TileSilo),
|
||||
ActionId::TileSilo,
|
||||
);
|
||||
tool_button(
|
||||
(0, 2),
|
||||
"button_off",
|
||||
"Button",
|
||||
Tool::SetTile(Tile::from_char('*')),
|
||||
Some(ActionId::TileButton),
|
||||
ActionId::TileButton,
|
||||
);
|
||||
tool_button(
|
||||
(0, 3),
|
||||
"io_tile_off",
|
||||
"Input/Output silo",
|
||||
Tool::SetTile(Tile::from_char('I')),
|
||||
Some(ActionId::TileIOSilo),
|
||||
ActionId::TileIOSilo,
|
||||
);
|
||||
tool_button(
|
||||
(0, 4),
|
||||
"flipper_off",
|
||||
"Flipper",
|
||||
Tool::SetTile(Tile::from_char('F')),
|
||||
Some(ActionId::TileFlipper),
|
||||
ActionId::TileFlipper,
|
||||
);
|
||||
tool_button(
|
||||
(0, 5),
|
||||
"digit_tool",
|
||||
"Digit",
|
||||
Tool::Digits(None),
|
||||
Some(ActionId::TileDigit),
|
||||
ActionId::TileDigit,
|
||||
);
|
||||
|
||||
tool_button(
|
||||
|
@ -1175,14 +1181,14 @@ impl Editor {
|
|||
"marble",
|
||||
"Marble",
|
||||
Tool::SetTile(Tile::from_char('o')),
|
||||
Some(ActionId::TileMarble),
|
||||
ActionId::TileMarble,
|
||||
);
|
||||
match tool_button(
|
||||
(1, 1),
|
||||
self.tool_wire.texture_name_off(),
|
||||
self.tool_wire.human_name(),
|
||||
Tool::Wire,
|
||||
Some(ActionId::TileGroupWire),
|
||||
ActionId::TileGroupWire,
|
||||
) {
|
||||
Some(Scroll::Down) => self.tool_wire.next(),
|
||||
Some(Scroll::Up) => self.tool_wire.prev(),
|
||||
|
@ -1194,7 +1200,7 @@ impl Editor {
|
|||
self.tool_arrow.arrow_tile_texture_name(),
|
||||
self.tool_arrow.arrow_tile_human_name(),
|
||||
Tool::Arrow,
|
||||
Some(ActionId::TileGroupArrow),
|
||||
ActionId::TileGroupArrow,
|
||||
) {
|
||||
Some(Scroll::Down) => self.tool_arrow = self.tool_arrow.right(),
|
||||
Some(Scroll::Up) => self.tool_arrow = self.tool_arrow.left(),
|
||||
|
@ -1205,7 +1211,7 @@ impl Editor {
|
|||
self.tool_mirror.texture_name(),
|
||||
self.tool_mirror.human_name(),
|
||||
Tool::Mirror,
|
||||
Some(ActionId::TileGroupMirror),
|
||||
ActionId::TileGroupMirror,
|
||||
)
|
||||
.is_some()
|
||||
{
|
||||
|
@ -1216,7 +1222,7 @@ impl Editor {
|
|||
self.tool_math.texture_name_off(),
|
||||
self.tool_math.human_name(),
|
||||
Tool::Math,
|
||||
Some(ActionId::TileGroupMath),
|
||||
ActionId::TileGroupMath,
|
||||
) {
|
||||
Some(Scroll::Down) => self.tool_math.next(),
|
||||
Some(Scroll::Up) => self.tool_math.prev(),
|
||||
|
@ -1227,7 +1233,7 @@ impl Editor {
|
|||
self.tool_comparator.texture_name_off(),
|
||||
self.tool_comparator.human_name(),
|
||||
Tool::Comparator,
|
||||
Some(ActionId::TileGroupCompare),
|
||||
ActionId::TileGroupCompare,
|
||||
) {
|
||||
Some(Scroll::Down) => self.tool_comparator.next(),
|
||||
Some(Scroll::Up) => self.tool_comparator.prev(),
|
||||
|
|
11
src/input.rs
11
src/input.rs
|
@ -23,7 +23,7 @@ pub enum ActionId {
|
|||
Copy,
|
||||
Cut,
|
||||
Paste,
|
||||
Erase,
|
||||
EraseSelection,
|
||||
ToggleMenu,
|
||||
Save,
|
||||
StartSim,
|
||||
|
@ -32,6 +32,10 @@ pub enum ActionId {
|
|||
CycleGroup,
|
||||
CycleGroupRevMod,
|
||||
|
||||
Eraser,
|
||||
Selection,
|
||||
Blueprints,
|
||||
NoTool,
|
||||
TileBlock,
|
||||
TileSilo,
|
||||
TileButton,
|
||||
|
@ -65,7 +69,7 @@ impl Default for Input {
|
|||
bind_key(ActionId::Copy, vec![LCtrl], C);
|
||||
bind_key(ActionId::Cut, vec![LCtrl], X);
|
||||
bind_key(ActionId::Paste, vec![LCtrl], V);
|
||||
bind_key(ActionId::Erase, vec![], Backspace);
|
||||
bind_key(ActionId::EraseSelection, vec![], Backspace);
|
||||
bind_key(ActionId::ToggleMenu, vec![], Escape);
|
||||
bind_key(ActionId::Save, vec![LCtrl], S);
|
||||
bind_key(ActionId::StartSim, vec![], Enter);
|
||||
|
@ -73,6 +77,9 @@ impl Default for Input {
|
|||
bind_key(ActionId::StepSim, vec![], Space);
|
||||
bind_key(ActionId::CycleGroup, vec![], Tab);
|
||||
bind_key(ActionId::CycleGroupRevMod, vec![], LShift);
|
||||
bind_key(ActionId::Eraser, vec![], X);
|
||||
bind_key(ActionId::Blueprints, vec![LCtrl], B);
|
||||
bind_key(ActionId::Selection, vec![], B);
|
||||
bind_key(ActionId::TileBlock, vec![], Q);
|
||||
bind_key(ActionId::TileSilo, vec![], W);
|
||||
bind_key(ActionId::TileButton, vec![], E);
|
||||
|
|
Loading…
Add table
Reference in a new issue