mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 16:00:08 +01:00
Format files using updated file_format.sh
This commit is contained in:
@@ -17,10 +17,10 @@ func _unhandled_input(event):
|
||||
if mouse_button_event.button_index == BUTTON_LEFT:
|
||||
_rotation_enabled = mouse_button_event.pressed
|
||||
return
|
||||
|
||||
|
||||
if not _rotation_enabled:
|
||||
return
|
||||
|
||||
|
||||
var mouse_motion_event = event as InputEventMouseMotion
|
||||
if mouse_motion_event:
|
||||
var rotation_delta = mouse_motion_event.relative.x
|
||||
|
||||
@@ -8,7 +8,7 @@ var _entry_template
|
||||
|
||||
func _enter_tree():
|
||||
Log.connect("entry_logged", self, "_on_log_entry")
|
||||
|
||||
|
||||
_entry_template = get_child(0) as Label
|
||||
remove_child(_entry_template)
|
||||
|
||||
@@ -22,16 +22,16 @@ func clear():
|
||||
|
||||
func _on_log_entry(message, type):
|
||||
var new_entry = _entry_template.duplicate() as Label
|
||||
|
||||
|
||||
new_entry.set_text(message)
|
||||
if type == Log.LogType.ERROR:
|
||||
new_entry.modulate = Color.red
|
||||
else:
|
||||
new_entry.modulate = Color.white
|
||||
|
||||
|
||||
if get_child_count() >= MAX_ENTRIES:
|
||||
var first_entry = get_child(0) as Label
|
||||
remove_child(first_entry)
|
||||
first_entry.queue_free()
|
||||
|
||||
|
||||
add_child(new_entry)
|
||||
|
||||
@@ -15,16 +15,16 @@ func _ready():
|
||||
func _process(_delta):
|
||||
if _attachment == null:
|
||||
return
|
||||
|
||||
|
||||
var viewport = get_viewport()
|
||||
if viewport == null:
|
||||
return
|
||||
|
||||
|
||||
var camera = viewport.get_camera()
|
||||
if camera == null:
|
||||
return
|
||||
|
||||
|
||||
var world_pos = world_offset + _attachment.global_transform.origin
|
||||
var screen_pos = camera.unproject_position(world_pos)
|
||||
|
||||
|
||||
rect_position = _pos_offset + screen_pos - 0.5 * rect_size
|
||||
|
||||
@@ -9,14 +9,14 @@ func add_menu_item(item_path):
|
||||
var path_elements = item_path.split("/", false)
|
||||
var path_element_count = path_elements.size()
|
||||
assert(path_element_count > 0)
|
||||
|
||||
|
||||
var path = ""
|
||||
var popup = get_popup()
|
||||
for element_index in path_element_count - 1:
|
||||
var popup_label = path_elements[element_index]
|
||||
path += popup_label + "/"
|
||||
popup = _add_popup(popup, path, popup_label)
|
||||
|
||||
|
||||
_add_item(popup, path_elements[path_element_count - 1])
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ func _add_popup(parent_popup, path, label):
|
||||
var popup_menu = popup_node as PopupMenu
|
||||
assert(popup_menu)
|
||||
return popup_menu
|
||||
|
||||
|
||||
var popup_menu = PopupMenu.new()
|
||||
popup_menu.name = label
|
||||
|
||||
|
||||
parent_popup.add_child(popup_menu)
|
||||
parent_popup.add_submenu_item(label, label)
|
||||
|
||||
|
||||
popup_menu.connect("index_pressed", self, "_on_item_pressed", [popup_menu, path])
|
||||
|
||||
|
||||
return popup_menu
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ var _engine = PhysicsEngine.OTHER
|
||||
|
||||
func _enter_tree():
|
||||
get_tree().debug_collisions_hint = true
|
||||
|
||||
|
||||
var engine_string = ProjectSettings.get_setting("physics/3d/physics_engine")
|
||||
match engine_string:
|
||||
"DEFAULT":
|
||||
@@ -28,7 +28,7 @@ func _enter_tree():
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed("toggle_full_screen"):
|
||||
OS.window_fullscreen = not OS.window_fullscreen
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("toggle_debug_collision"):
|
||||
var debug_collision_enabled = not _is_debug_collision_enabled()
|
||||
_set_debug_collision_enabled(debug_collision_enabled)
|
||||
@@ -36,7 +36,7 @@ func _process(_delta):
|
||||
Log.print_log("Debug Collision ON")
|
||||
else:
|
||||
Log.print_log("Debug Collision OFF")
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("exit"):
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user