Added a dynamic layout system where UI elements can be moved about on a tiled grid.

This commit is contained in:
RedNicStone committed 2026-11-09 18:14:52 +01:00
1 parent ea6ba54666
commit 26c29df4ad
34 files changed
+1269

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
shader_type canvas_item;
render_mode unshaded;
uniform vec2 grid_size = vec2(32.0, 18.0);
uniform vec4 line_color : source_color;
uniform vec4 boundary_color : source_color;
uniform float monitor_boundary = 0.0;
float grid_coverage(vec2 coordinate, float width) {
vec2 distance_to_line = abs(fract(coordinate + 0.5) - 0.5);
vec2 pixels = distance_to_line / max(fwidth(coordinate), vec2(0.00001));
vec2 coverage = 1.0 - smoothstep(vec2(width - 0.5), vec2(width + 0.5), pixels);
return max(coverage.x, coverage.y);
}
void fragment() {
vec2 cells = UV * grid_size;
float minor = grid_coverage(cells, 0.6) * 0.4;
float major = grid_coverage(cells / 4.0, 0.8) * 0.85;
vec2 edge_pixels = min(UV, 1.0 - UV) / max(fwidth(UV), vec2(0.00001));
float border = 1.0 - smoothstep(0.5, 1.5, min(edge_pixels.x, edge_pixels.y));
float alpha = max(max(minor, major), border);
vec4 result = vec4(line_color.rgb, line_color.a * alpha);
if (monitor_boundary > 0.0 && monitor_boundary < grid_size.x) {
float distance_pixels = abs(cells.x - monitor_boundary) / max(fwidth(cells.x), 0.00001);
float boundary = 1.0 - smoothstep(1.0, 2.0, distance_pixels);
result = mix(result, boundary_color, boundary);
}
COLOR = result;
}
+1
View File
@@ -0,0 +1 @@
uid://beaucnaf4ol72