Skip to content

Instantly share code, notes, and snippets.

View phnix-dev's full-sized avatar

phnix-dev

View GitHub Profile
@Structed
Structed / ScreenAnchor.gd
Created October 11, 2023 21:28
Godot ScreenAnchor
# ScreenAnchor as tweeted by @the_duriel: https://x.com/the_duriel/status/1712183527477809452?s=20
@tool
extends MarginContainer
class_name ScreenAnchor
## Control which can be anchored to a relative screen position
@export var offset: Vector2 = Vector2(0.5, 0.5):
set(value): offset = value; _update_position()
enum ORIGIN {CENTER, TOP_LEFT, TOP_RIGHT, BOT_LEFT, BOT_RIGHT}