This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform sampler2D screen_texture : hint_screen_texture, filter_nearest; | |
uniform float radius = 3.0; | |
void fragment() { | |
vec2 uv = SCREEN_UV; | |
uv.y = 1.0 - uv.y; // seems like the origin changed in Godot 4. | |
vec2 surface = vec2(0.5, 0.2); | |
vec2 center = surface - vec2(0, radius); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends LineEdit | |
var allowed_characters = "[A-Za-z]" | |
func _on_LineEdit_text_changed(new_text): | |
var old_caret_position = self.caret_position | |
var word = '' | |
var regex = RegEx.new() | |
regex.compile(allowed_characters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test_output(): | |
print (get_scientific_notation(123456789.0, 0)) # 1e8 | |
print (get_scientific_notation(123456789.0, 1)) # 1.2e8 | |
print (get_scientific_notation(123456789.0)) # 1.2345678e8 | |
print (get_scientific_notation(0.123456789, 0)) # 1e-1 | |
print (get_scientific_notation(0.123456789, 1)) # 1.2e-1 | |
print (get_scientific_notation(0.123456789)) # 1.2345678e-1 | |
print (get_scientific_notation(12345, 0, true)) # 12e3 | |
print (get_scientific_notation(1234567, 0, true)) # 1e6 | |
print (get_scientific_notation(123456789, 0, true)) # 123e6 |