Skip to content

Commit

Permalink
Added Ctrl+S save shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Apr 18, 2024
1 parent c874da0 commit a988725
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Scenes/Camera2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func mouse_edge_pan():
panDirectionMouse = panDirectionMouse.normalized()

func keyboard_pan():
if Input.is_action_pressed("save"): return
if Input.is_action_pressed('keyboard_zoom_in'): return
if Input.is_action_pressed('keyboard_zoom_out'): return

Expand Down
6 changes: 6 additions & 0 deletions Scenes/Menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ func constantly_monitor_play_button_state():
else:
oMenuPlayButton.text = "Play"

func pressed_save_keyboard_shortcut():
if oMenuButtonFile.get_popup().is_item_disabled(oMenuButtonFile.get_popup().get_item_index(4)) == true:
_on_FileSubmenu_Pressed(5) # Save As
else:
_on_FileSubmenu_Pressed(4) # Save

func _on_FileSubmenu_Pressed(pressedID):
match pressedID:
0: Utils.popup_centered(oNewMapWindow)#oCurrentMap._on_ButtonNewMap_pressed() # New
Expand Down
5 changes: 5 additions & 0 deletions Scenes/SaveMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ onready var oMenu = Nodelist.list["oMenu"]
onready var oCurrentFormat = Nodelist.list["oCurrentFormat"]
onready var oDataClm = Nodelist.list["oDataClm"]
onready var oBuffers = Nodelist.list["oBuffers"]
onready var oMenuButtonFile = Nodelist.list["oMenuButtonFile"]

var queueExit = false

func _input(event):
if event.is_action_pressed("save"):
oMenu.pressed_save_keyboard_shortcut()

func save_map(filePath): # auto opens other files
var map = filePath.get_basename()
var SAVETIME_START = OS.get_ticks_msec()
Expand Down
5 changes: 5 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ redo={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":89,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}
save={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
]
}

[mono]

Expand Down

0 comments on commit a988725

Please sign in to comment.