Skip to content

Commit

Permalink
Added debug shortcut for custom commands
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Sep 22, 2023
1 parent d798e16 commit 0a79bb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/electron.renderer/App.hx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class App extends dn.Process {

// Parse AppCommands meta
var meta = haxe.rtti.Meta.getFields(AppCommand);
var keyNameReg = ~/(ctrl|shift|alt| |-|\+|\[wasd\]|\[zqsd\]|\[arrows\]|\[win\]|\[linux\]|\[mac\])/gi;
var keyNameReg = ~/(ctrl|shift|alt| |-|\+|\[wasd\]|\[zqsd\]|\[arrows\]|\[win\]|\[linux\]|\[mac\]|\[debug\])/gi;
for(k in AppCommand.getConstructors()) {
var cmd = AppCommand.createByName(k);
var cmdMeta : Dynamic = Reflect.field(meta, k);
Expand Down Expand Up @@ -247,6 +247,7 @@ class App extends dn.Process {
alt: rawCombo.indexOf("alt")>=0,
navKeys: navKeys,
os: os,
debug: rawCombo.indexOf("[debug]")>=0,
allowInInputs: Reflect.hasField(cmdMeta, "input"),
command: cmd,
});
Expand Down
3 changes: 2 additions & 1 deletion src/electron.renderer/EditorTypes.hx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ typedef KeyBinding = {

var navKeys : Null<Settings.NavigationKeys>;
var os : Null<String>;
var debug: Bool;

var allowInInputs : Bool;

Expand All @@ -263,7 +264,7 @@ enum AppCommand {
@k("tab") C_ZenMode;
@k("h") C_ShowHelp;
@k("shift w, ², `, [zqsd] w, [arrows] w") C_ToggleWorldMode;
@k("ctrl r") @input C_RunCommand;
@k("ctrl r, [debug] ctrl shift r") @input C_RunCommand;
@k("ctrl q") @input C_ExitApp;
@k("pagedown") C_GotoPreviousWorldLayer;
@k("pageup") C_GotoNextWorldLayer;
Expand Down
5 changes: 5 additions & 0 deletions src/electron.renderer/page/Editor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,11 @@ class Editor extends Page {
if( b.navKeys!=null && b.navKeys!=settings.v.navigationKeys )
continue;

#if( !debug )
if( b.debug )
continue;
#end

switch b.os {
case null:
case "win": if( !App.isWindows() ) continue;
Expand Down

0 comments on commit 0a79bb2

Please # to comment.