Name popups *Popup and give scripts, scenes and classes matching names

Every popup is now called *Popup instead of *Window in its file, root node,
node name, class and variable, and PopupWindow becomes BasePopup. Player is
PlayerRow, SongListObject is SongRow and Character is CharacterCard. Script
files are snake_case and scene files PascalCase, each matching its class or
root node, and LightGrayTheme.tres is light_gray_theme.tres.
This commit is contained in:
Sansan committed 2026-10-06 11:22:39 +02:00
1 parent b7d67b573e
commit 390da577d7
78 files changed
+281 -258

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
class_name BasePopup
extends Control
## A window shown on top of the main window, such as Settings or About.
##
## Clicking outside [member panel] closes it. Popups that need to prepare or clean up
## override [method open] or [method close] and call [code]super()[/code].
## The visible part of the popup. Clicks outside it close the popup.
@export var panel: Control
## Shows the popup.
func open() -> void:
visible = true
## Hides the popup.
func close() -> void:
visible = false
## Opens the popup if it is closed and closes it if it is open.
func toggle() -> void:
if visible:
close()
else:
open()
func _input(event: InputEvent) -> void:
if !visible || !(event is InputEventMouseButton) || !event.pressed:
return
var click: InputEventMouseButton = panel.make_input_local(event)
if !Rect2(Vector2.ZERO, panel.size).has_point(click.position):
close()
# The click only closes the popup; it must not also press what is behind it
get_viewport().set_input_as_handled()