Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View HungryProton's full-sized avatar

HungryProton HungryProton

View GitHub Profile
@HungryProton
HungryProton / ui_scaling.gd
Last active July 21, 2020 21:55
UI scaling to make the interface appear larger on high dpi monitors
static func get_scaled_theme(theme: Theme) -> Theme:
var scale = get_editor_scale()
var res: Theme = theme.duplicate(true)
res.default_font.size *= scale
for font_name in res.get_font_list("EditorFonts"):
var font = res.get_font(font_name, "EditorFonts")
font.size *= scale
@HungryProton
HungryProton / component.gd
Last active September 14, 2020 09:04
ECS protoype
"""
This is the base Component class. Every component should inherit from this.
It only stores data. Its only responsibility is to notify the parent Entity when its
created. (Or we could setup something in the Entity to monitor new components
but I just find it easier this way)
"""
extends Node
class_name Component
@HungryProton
HungryProton / node_pool.gd
Last active May 5, 2020 11:58
A simple node pool that works with an arbitrary amount of different node types.
tool
extends Node
class_name NodePool
var _pools := {}
func _exit_tree() -> void:
clear()
func extrude(bevel: Array, path: Path):
# Bevel is your cross section, it's an array of Vector3
# Path is the curve we're following
var resolution = 1.0
var curve: Curve3D = path.curve
var length: float = curve.get_baked_length()
var steps: int = floor(length / resolution)
var offset: float = length / steps
@HungryProton
HungryProton / shader_cache.gd
Last active November 11, 2023 20:03
Godot shader cache hack
extends Spatial
var _materials := []
var _process_materials := []
var _count := 0
func _ready() -> void:
_find_all_materials("res://")
print(_process_materials)

Keybase proof

I hereby claim:

  • I am hungryproton on github.
  • I am hungryproton (https://keybase.io/hungryproton) on keybase.
  • I have a public key ASDsS255eo0PcZ4LvlRg6jyN_9kbixIrw2_oE7_lLxqtdwo

To claim this, I am signing this object: