12345678910111213141516171819202122232425262728 |
- @icon("res://common/graphics/icons/godot_icon_slide.svg")
- class_name Slide
- extends Node2D
- # Display slide content
- signal finished
- var center_offset: Vector2
- func _ready():
- center_offset = _compute_center_offset()
- func get_center():
- return get_position() + center_offset
- func _unhandled_key_input(event: InputEvent):
- if event.is_action("ui_accept") and event.is_pressed():
- finished.emit()
- func _compute_center_offset() -> Vector2:
- var w: float = ProjectSettings.get("display/window/size/viewport_width")
- var h: float = ProjectSettings.get("display/window/size/viewport_height")
- return Vector2(w * scale.x / 2, h * scale.y / 2)
|