Skip to content

Instantly share code, notes, and snippets.

View phnix-dev's full-sized avatar

phnix-dev

View GitHub Profile
@geekley
geekley / NumberLimits.gd
Last active May 9, 2025 16:48
Numerical constants for limits of integers and IEEE 754 floats, defined as calculations of their exact values.
# Public domain, as per The Unlicense. NO WARRANTY. See https://unlicense.org
class_name NumberLimits
## Useful for dealing with numerical limits.
## Minimum positive 64-bit floating-point number > 0.
## [br]0x0000000000000001
const FLOAT64_MIN_SUBNORMAL: float = 2.0**-1074 # ≈ 4.9406564584124654e-324
## Maximum positive 64-bit floating-point subnormal number (min possible value in binary exponent).
## [br]0x000FFFFFFFFFFFFF
@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}