├── .gitignore ├── BackgroundGenerator ├── 100x100.png ├── 100x100.png.import ├── BackgroundGenerator.gd ├── BackgroundGenerator.tscn ├── BigStar.gd ├── BigStar.tscn ├── Colorscheme.tres ├── Nebulae.shader ├── Nebulae.tres ├── Planet.gd ├── Planet.tscn ├── StarParticles.tres ├── StarStuff.shader ├── StarStuff.tres ├── stars-special.png ├── stars-special.png.import ├── stars.png └── stars.png.import ├── GUI ├── ColorPickerButton.tscn ├── Font.tres ├── FontSmall.tres ├── FontSmaller.tres ├── GUI.gd ├── GUI.tscn ├── SchemeSelectButton.gd ├── SchemeSelectButton.tscn ├── Theme.tres ├── empty.png ├── empty.png.import ├── grabber-highlight.png ├── grabber-highlight.png.import ├── grabber.png ├── grabber.png.import ├── slkscre.ttf ├── transparent.png └── transparent.png.import ├── LICENSE ├── README.md ├── addons └── HTML5FileExchange │ ├── HTML5FileExchange.gd │ ├── plugin.cfg │ └── plugin.gd ├── default_env.tres ├── icon.png ├── icon.png.import └── project.godot /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Godot-specific ignores 3 | .import/ 4 | export.cfg 5 | export_presets.cfg 6 | 7 | # Mono-specific ignores 8 | .mono/ 9 | data_*/ 10 | -------------------------------------------------------------------------------- /BackgroundGenerator/100x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/BackgroundGenerator/100x100.png -------------------------------------------------------------------------------- /BackgroundGenerator/100x100.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/100x100.png-7bbc034c9bfda2cbad80db23f6fc9925.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://BackgroundGenerator/100x100.png" 13 | dest_files=[ "res://.import/100x100.png-7bbc034c9bfda2cbad80db23f6fc9925.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /BackgroundGenerator/BackgroundGenerator.gd: -------------------------------------------------------------------------------- 1 | extends Control 2 | 3 | onready var background = $CanvasLayer/Background 4 | onready var starstuff = $StarStuff 5 | onready var nebulae = $Nebulae 6 | onready var particles = $StarParticles 7 | onready var starcontainer = $StarContainer 8 | onready var planetcontainer = $PlanetContainer 9 | onready var planet_scene = preload("res://BackgroundGenerator/Planet.tscn") 10 | onready var big_star_scene = preload("res://BackgroundGenerator/BigStar.tscn") 11 | 12 | var should_tile = false 13 | var reduce_background = false 14 | var mirror_size = Vector2(200,200) 15 | 16 | export (GradientTexture) var colorscheme 17 | var planet_objects = [] 18 | var star_objects = [] 19 | 20 | #func _ready(): 21 | # _set_new_colors(colorscheme, background_color) 22 | 23 | func set_mirror_size(new): 24 | mirror_size = new 25 | 26 | func toggle_tile(): 27 | should_tile = !should_tile 28 | starstuff.material.set_shader_param("should_tile", should_tile) 29 | nebulae.material.set_shader_param("should_tile", should_tile) 30 | 31 | _make_new_planets() 32 | _make_new_stars() 33 | 34 | func toggle_reduce_background(): 35 | reduce_background = !reduce_background 36 | starstuff.material.set_shader_param("reduce_background", reduce_background) 37 | nebulae.material.set_shader_param("reduce_background", reduce_background) 38 | 39 | func generate_new(): 40 | starstuff.material.set_shader_param("seed", rand_range(1.0, 10.0)) 41 | starstuff.material.set_shader_param("pixels", max(rect_size.x, rect_size.y)) 42 | 43 | var aspect = Vector2(1,1) 44 | if rect_size.x > rect_size.y: 45 | aspect = Vector2(rect_size.x / rect_size.y, 1.0) 46 | else: 47 | aspect = Vector2(1.0, rect_size.y / rect_size.x) 48 | 49 | starstuff.material.set_shader_param("uv_correct", aspect) 50 | nebulae.material.set_shader_param("seed", rand_range(1.0, 10.0)) 51 | nebulae.material.set_shader_param("pixels", max(rect_size.x, rect_size.y)) 52 | nebulae.material.set_shader_param("uv_correct", aspect) 53 | 54 | particles.speed_scale = 1.0 55 | particles.amount = 1 56 | particles.position = rect_size * 0.5 57 | particles.process_material.set_shader_param("emission_box_extents", Vector3(rect_size.x * 0.5, rect_size.y*0.5,1.0)) 58 | 59 | var p_amount = (rect_size.x * rect_size.y) / 150 60 | particles.amount = randi()%(int(p_amount * 0.75)) + int(p_amount * 0.25) 61 | 62 | $PauseParticles.start() 63 | 64 | _make_new_planets() 65 | _make_new_stars() 66 | 67 | func _make_new_stars(): 68 | for s in star_objects: 69 | s.queue_free() 70 | star_objects = [] 71 | 72 | var star_amount = int(max(rect_size.x, rect_size.y) / 20) 73 | star_amount = max(star_amount, 1) 74 | for i in randi()%star_amount: 75 | _place_big_star() 76 | 77 | func _make_new_planets(): 78 | for p in planet_objects: 79 | p.queue_free() 80 | planet_objects = [] 81 | 82 | var planet_amount = 5#int(rect_size.x * rect_size.y) / 8000 83 | for i in randi()%planet_amount: 84 | _place_planet() 85 | 86 | func _set_new_colors(new_scheme, new_background): 87 | colorscheme = new_scheme 88 | 89 | starstuff.material.set_shader_param("colorscheme", colorscheme) 90 | nebulae.material.set_shader_param("colorscheme", colorscheme) 91 | nebulae.material.set_shader_param("background_color", new_background) 92 | 93 | particles.process_material.set_shader_param("colorscheme", colorscheme) 94 | for p in planet_objects: 95 | p.material.set_shader_param("colorscheme", colorscheme) 96 | for s in star_objects: 97 | s.material.set_shader_param("colorscheme", colorscheme) 98 | 99 | func _place_planet(): 100 | var min_size = min(rect_size.x, rect_size.y) 101 | var scale = Vector2(1,1)*(rand_range(0.2, 0.7)*rand_range(0.5, 1.0)*min_size*0.005) 102 | 103 | var pos = Vector2() 104 | if (should_tile): 105 | var offs = scale.x * 100.0 * 0.5 106 | pos = Vector2(int(rand_range(offs, rect_size.x - offs)), int(rand_range(offs, rect_size.y - offs))) 107 | else: 108 | pos = Vector2(int(rand_range(0, rect_size.x)), int(rand_range(0, rect_size.y))) 109 | 110 | var planet = planet_scene.instance() 111 | planet.scale = scale 112 | planet.position = pos 113 | planetcontainer.add_child(planet) 114 | planet_objects.append(planet) 115 | 116 | func _place_big_star(): 117 | var pos = Vector2() 118 | if (should_tile): 119 | var offs = 10.0 120 | pos = Vector2(int(rand_range(offs, rect_size.x - offs)), int(rand_range(offs, rect_size.y - offs))) 121 | else: 122 | pos = Vector2(int(rand_range(0, rect_size.x)), int(rand_range(0, rect_size.y))) 123 | 124 | var star = big_star_scene.instance() 125 | star.position = pos 126 | starcontainer.add_child(star) 127 | star_objects.append(star) 128 | 129 | func _on_PauseParticles_timeout(): 130 | particles.speed_scale = 0.0 131 | 132 | func set_background_color(c): 133 | background.color = c 134 | nebulae.material.set_shader_param("background_color", c) 135 | 136 | func toggle_dust(): 137 | starstuff.visible = !starstuff.visible 138 | 139 | func toggle_stars(): 140 | starcontainer.visible = !starcontainer.visible 141 | particles.visible = !particles.visible 142 | 143 | func toggle_nebulae(): 144 | $Nebulae.visible = !$Nebulae.visible 145 | 146 | func toggle_planets(): 147 | planetcontainer.visible = !planetcontainer.visible 148 | 149 | func toggle_transparancy(): 150 | $CanvasLayer/Background.visible = !$CanvasLayer/Background.visible 151 | -------------------------------------------------------------------------------- /BackgroundGenerator/BackgroundGenerator.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=8 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/BackgroundGenerator.gd" type="Script" id=1] 4 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=2] 5 | [ext_resource path="res://BackgroundGenerator/StarStuff.tres" type="Material" id=3] 6 | [ext_resource path="res://BackgroundGenerator/stars.png" type="Texture" id=4] 7 | [ext_resource path="res://BackgroundGenerator/StarParticles.tres" type="Material" id=5] 8 | [ext_resource path="res://BackgroundGenerator/Nebulae.tres" type="Material" id=6] 9 | 10 | [sub_resource type="CanvasItemMaterial" id=1] 11 | particles_animation = true 12 | particles_anim_h_frames = 16 13 | particles_anim_v_frames = 1 14 | particles_anim_loop = false 15 | 16 | [node name="BackgroundGenerator" type="Control"] 17 | margin_right = -962.0 18 | margin_bottom = -500.0 19 | rect_min_size = Vector2( 100, 100 ) 20 | script = ExtResource( 1 ) 21 | __meta__ = { 22 | "_edit_use_anchors_": false 23 | } 24 | colorscheme = ExtResource( 2 ) 25 | 26 | [node name="CanvasLayer" type="CanvasLayer" parent="."] 27 | layer = -1 28 | 29 | [node name="Background" type="ColorRect" parent="CanvasLayer"] 30 | anchor_right = 1.0 31 | anchor_bottom = 1.0 32 | color = Color( 0.0901961, 0.0901961, 0.0666667, 1 ) 33 | __meta__ = { 34 | "_edit_use_anchors_": false 35 | } 36 | 37 | [node name="StarStuff" type="ColorRect" parent="."] 38 | material = ExtResource( 3 ) 39 | anchor_right = 1.0 40 | anchor_bottom = 1.0 41 | margin_right = 7.62939e-06 42 | margin_bottom = 7.62939e-06 43 | __meta__ = { 44 | "_edit_use_anchors_": false 45 | } 46 | 47 | [node name="StarParticles" type="Particles2D" parent="."] 48 | material = SubResource( 1 ) 49 | position = Vector2( 50, 50 ) 50 | amount = 100 51 | visibility_rect = Rect2( -1000, -1000, 2000, 2000 ) 52 | process_material = ExtResource( 5 ) 53 | texture = ExtResource( 4 ) 54 | 55 | [node name="Nebulae" type="ColorRect" parent="."] 56 | material = ExtResource( 6 ) 57 | anchor_right = 1.0 58 | anchor_bottom = 1.0 59 | __meta__ = { 60 | "_edit_use_anchors_": false 61 | } 62 | 63 | [node name="StarContainer" type="Node2D" parent="."] 64 | 65 | [node name="PlanetContainer" type="Node2D" parent="."] 66 | 67 | [node name="PauseParticles" type="Timer" parent="."] 68 | wait_time = 0.5 69 | one_shot = true 70 | 71 | [connection signal="timeout" from="PauseParticles" to="." method="_on_PauseParticles_timeout"] 72 | -------------------------------------------------------------------------------- /BackgroundGenerator/BigStar.gd: -------------------------------------------------------------------------------- 1 | extends Sprite 2 | 3 | func _ready(): 4 | texture = texture.duplicate() 5 | texture.region.position.x = (randi()%5)*25.0 6 | -------------------------------------------------------------------------------- /BackgroundGenerator/BigStar.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=7 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/stars-special.png" type="Texture" id=1] 4 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=2] 5 | [ext_resource path="res://BackgroundGenerator/BigStar.gd" type="Script" id=3] 6 | 7 | [sub_resource type="Shader" id=1] 8 | code = "shader_type canvas_item; 9 | render_mode blend_mix, unshaded; 10 | 11 | uniform sampler2D colorscheme; 12 | 13 | void fragment() { 14 | float col_val = texture(TEXTURE, UV).r; 15 | float a = texture(TEXTURE, UV).a; 16 | vec4 replace_col = texture(colorscheme, vec2(round(col_val * 7.0) / 7.0, 0.0)); 17 | COLOR = vec4(replace_col.rgb, a); 18 | }" 19 | 20 | [sub_resource type="ShaderMaterial" id=2] 21 | shader = SubResource( 1 ) 22 | shader_param/colorscheme = ExtResource( 2 ) 23 | 24 | [sub_resource type="AtlasTexture" id=3] 25 | atlas = ExtResource( 1 ) 26 | region = Rect2( 25, 0, 25, 25 ) 27 | 28 | [node name="BigStar" type="Sprite"] 29 | material = SubResource( 2 ) 30 | texture = SubResource( 3 ) 31 | script = ExtResource( 3 ) 32 | -------------------------------------------------------------------------------- /BackgroundGenerator/Colorscheme.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="GradientTexture" load_steps=2 format=2] 2 | 3 | [sub_resource type="Gradient" id=1] 4 | offsets = PoolRealArray( 0, 0.143, 0.286, 0.429, 0.571, 0.714, 0.857, 1 ) 5 | colors = PoolColorArray( 0.12549, 0.133333, 0.0823529, 1, 0.227451, 0.156863, 0.00784314, 1, 0.588235, 0.235294, 0.235294, 1, 0.792157, 0.352941, 0.180392, 1, 1, 0.470588, 0.192157, 1, 0.952941, 0.6, 0.286275, 1, 0.921569, 0.760784, 0.458824, 1, 0.87451, 0.843137, 0.521569, 1 ) 6 | 7 | [resource] 8 | gradient = SubResource( 1 ) 9 | -------------------------------------------------------------------------------- /BackgroundGenerator/Nebulae.shader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | render_mode blend_mix,unshaded; 3 | 4 | uniform float size = 50.0; 5 | uniform int OCTAVES : hint_range(0, 20, 1); 6 | uniform float seed: hint_range(1, 10); 7 | uniform float pixels = 100.0; 8 | uniform sampler2D colorscheme; 9 | uniform vec4 background_color : hint_color; 10 | uniform bool should_tile = false; 11 | uniform bool reduce_background = false; 12 | uniform vec2 uv_correct = vec2(1.0); 13 | 14 | float rand(vec2 coord, float tilesize) { 15 | if (should_tile) { 16 | coord = mod(coord / uv_correct, tilesize); 17 | } 18 | 19 | return fract(sin(dot(coord.xy ,vec2(12.9898,78.233))) * (15.5453 + seed)); 20 | } 21 | 22 | float noise(vec2 coord, float tilesize){ 23 | vec2 i = floor(coord); 24 | vec2 f = fract(coord); 25 | 26 | float a = rand(i, tilesize); 27 | float b = rand(i + vec2(1.0, 0.0), tilesize); 28 | float c = rand(i + vec2(0.0, 1.0), tilesize); 29 | float d = rand(i + vec2(1.0, 1.0), tilesize); 30 | 31 | vec2 cubic = f * f * (3.0 - 2.0 * f); 32 | 33 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 34 | } 35 | 36 | float fbm(vec2 coord, float tilesize){ 37 | float value = 0.0; 38 | float scale = 0.5; 39 | 40 | for(int i = 0; i < OCTAVES ; i++){ 41 | value += noise(coord, tilesize ) * scale; 42 | coord *= 2.0; 43 | scale *= 0.5; 44 | } 45 | return value; 46 | } 47 | 48 | bool dither(vec2 uv1, vec2 uv2) { 49 | return mod(uv1.y+uv2.x,2.0/pixels) <= 1.0 / pixels; 50 | } 51 | 52 | float circleNoise(vec2 uv, float tilesize) { 53 | if (should_tile) { 54 | uv = mod(uv, tilesize / uv_correct); 55 | } 56 | 57 | float uv_y = floor(uv.y); 58 | uv.x += uv_y*.31; 59 | vec2 f = fract(uv); 60 | float h = rand(vec2(floor(uv.x),floor(uv_y)), tilesize); 61 | float m = (length(f-0.25-(h*0.5))); 62 | float r = h*0.25; 63 | return smoothstep(0.0, r, m*0.75); 64 | } 65 | 66 | vec2 rotate(vec2 vec, float angle) { 67 | vec -=vec2(0.5); 68 | vec *= mat2(vec2(cos(angle),-sin(angle)), vec2(sin(angle),cos(angle))); 69 | vec += vec2(0.5); 70 | return vec; 71 | } 72 | 73 | float cloud_alpha(vec2 uv, float tilesize) { 74 | float c_noise = 0.0; 75 | 76 | // more iterations for more turbulence 77 | int iters = 2; 78 | for (int i = 0; i < iters; i++) { 79 | c_noise += circleNoise(uv * 0.5 + (float(i+1)) + vec2(-0.3, 0.0), ceil(tilesize * 0.5)); 80 | } 81 | float fbm = fbm(uv+c_noise, tilesize); 82 | 83 | return fbm; 84 | } 85 | 86 | void fragment() { 87 | // pixelizing and dithering 88 | vec2 uv = floor((UV) * pixels) / pixels; 89 | 90 | // distance from center 91 | float d = distance(uv, vec2(0.5)) * 0.4; 92 | 93 | uv *= uv_correct; 94 | bool dith = dither(uv, UV); 95 | 96 | // noise for the inside of the nebulae 97 | float n = cloud_alpha(uv * size, size); 98 | float n2 = fbm(uv * size + vec2(1, 1), size); 99 | float n_lerp = n2 * n; 100 | float n_dust = cloud_alpha(uv * size, size); 101 | float n_dust_lerp = n_dust * n_lerp; 102 | 103 | // apply dithering 104 | if (dith) { 105 | n_dust_lerp *= 0.95; 106 | n_lerp *= 0.95; 107 | d*= 0.98; 108 | } 109 | 110 | // slightly offset alpha values to create thin bands around the nebulae 111 | float a = step(n2, 0.1 + d); 112 | float a2 = step(n2, 0.115 + d); 113 | if (should_tile) { 114 | a = step(n2, 0.3); 115 | a2 = step(n2, 0.315); 116 | } 117 | 118 | // choose colors 119 | if (reduce_background) { 120 | n_dust_lerp = pow(n_dust_lerp, 1.2) * 0.7; 121 | } 122 | float col_value = 0.0; 123 | if (a2 > a) { 124 | col_value = floor(n_dust_lerp * 35.0) / 7.0; 125 | } else { 126 | col_value = floor(n_dust_lerp * 14.0) / 7.0; 127 | } 128 | 129 | // apply colors 130 | vec3 col = texture(colorscheme, vec2(col_value, 0.0)).rgb; 131 | if (col_value < 0.1) { 132 | col = background_color.rgb; 133 | } 134 | 135 | COLOR = vec4(col, a2); 136 | } -------------------------------------------------------------------------------- /BackgroundGenerator/Nebulae.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="ShaderMaterial" load_steps=3 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=1] 4 | [ext_resource path="res://BackgroundGenerator/Nebulae.shader" type="Shader" id=2] 5 | 6 | [resource] 7 | shader = ExtResource( 2 ) 8 | shader_param/size = 5.0 9 | shader_param/OCTAVES = 3 10 | shader_param/seed = 4.507 11 | shader_param/pixels = 500.0 12 | shader_param/background_color = Color( 0.0901961, 0.0901961, 0.0666667, 1 ) 13 | shader_param/should_tile = true 14 | shader_param/reduce_background = false 15 | shader_param/uv_correct = Vector2( 1, 1 ) 16 | shader_param/colorscheme = ExtResource( 1 ) 17 | -------------------------------------------------------------------------------- /BackgroundGenerator/Planet.gd: -------------------------------------------------------------------------------- 1 | extends Sprite 2 | 3 | func _ready(): 4 | material = material.duplicate() 5 | var light_x = rand_range(0.0, 1.0) 6 | var light_y = rand_range(0.0, 1.0) 7 | material.set_shader_param("light_origin", Vector2(light_x, light_y)) 8 | material.set_shader_param("seed", rand_range(1.0, 10.0)) 9 | material.set_shader_param("pixels", int(scale.x*100)) 10 | -------------------------------------------------------------------------------- /BackgroundGenerator/Planet.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=6 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/100x100.png" type="Texture" id=1] 4 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=2] 5 | [ext_resource path="res://BackgroundGenerator/Planet.gd" type="Script" id=3] 6 | 7 | [sub_resource type="Shader" id=1] 8 | code = "shader_type canvas_item; 9 | render_mode blend_mix, unshaded; 10 | 11 | uniform float size = 50.0; 12 | uniform int OCTAVES : hint_range(0, 20, 1); 13 | uniform float seed: hint_range(1, 10); 14 | uniform float pixels = 100.0; 15 | uniform sampler2D colorscheme; 16 | uniform vec2 light_origin; 17 | 18 | 19 | float rand(vec2 coord) { 20 | return fract(sin(dot(coord.xy ,vec2(12.9898,78.233))) * 15.5453 * seed); 21 | } 22 | 23 | float noise(vec2 coord){ 24 | vec2 i = floor(coord); 25 | vec2 f = fract(coord); 26 | 27 | float a = rand(i); 28 | float b = rand(i + vec2(1.0, 0.0)); 29 | float c = rand(i + vec2(0.0, 1.0)); 30 | float d = rand(i + vec2(1.0, 1.0)); 31 | 32 | vec2 cubic = f * f * (3.0 - 2.0 * f); 33 | 34 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 35 | } 36 | 37 | float fbm(vec2 coord){ 38 | float value = 0.0; 39 | float scale = 0.5; 40 | 41 | for(int i = 0; i < OCTAVES ; i++){ 42 | value += noise(coord) * scale; 43 | coord *= 2.0; 44 | scale *= 0.5; 45 | } 46 | return value; 47 | } 48 | 49 | bool dither(vec2 uv1, vec2 uv2) { 50 | return mod(uv1.y+uv2.x,2.0/pixels) <= 1.0 / pixels; 51 | } 52 | 53 | float circleNoise(vec2 uv) { 54 | float uv_y = floor(uv.y); 55 | uv.x += uv_y*.31; 56 | vec2 f = fract(uv); 57 | float h = rand(vec2(floor(uv.x),floor(uv_y))); 58 | float m = (length(f-0.25-(h*0.5))); 59 | float r = h*0.25; 60 | return smoothstep(0.0, r, m*0.75); 61 | } 62 | 63 | vec2 rotate(vec2 vec, float angle) { 64 | vec -=vec2(0.5); 65 | vec *= mat2(vec2(cos(angle),-sin(angle)), vec2(sin(angle),cos(angle))); 66 | vec += vec2(0.5); 67 | return vec; 68 | } 69 | 70 | vec2 spherify(vec2 uv) { 71 | vec2 centered = uv *2.0-1.0; 72 | float z = sqrt(1.0 - dot(centered.xy, centered.xy)); 73 | // float z = pow(1.0 - dot(centered.xy, centered.xy), 0.5); 74 | vec2 sphere = centered/(z + 1.0); 75 | 76 | return sphere * 0.5+0.5; 77 | } 78 | 79 | float cloud_alpha(vec2 uv) { 80 | float c_noise = 0.0; 81 | 82 | // more iterations for more turbulence 83 | int iters = 2; 84 | for (int i = 0; i < iters; i++) { 85 | float relative = (float(i)/float(iters)); 86 | vec2 c_uv = rotate(uv, relative * 6.28); 87 | c_noise += circleNoise((uv * 0.3) + (float(i+1)+10.)); 88 | } 89 | float fbm = fbm(uv+c_noise); 90 | 91 | return fbm; 92 | } 93 | 94 | 95 | void fragment() { 96 | /// pixelzing and dithering 97 | vec2 uv = floor(UV * pixels) / pixels; 98 | bool dith = dither(UV, uv); 99 | 100 | // distance from center, to create a circle 101 | float d_to_center = distance(uv , vec2(0.5)); 102 | uv = spherify(uv); 103 | 104 | // distance from light source, to create shading 105 | float d_to_light = distance(uv, light_origin); 106 | // bit of contrast 107 | d_to_light += pow(d_to_center * 3.0, 4.0) * 0.05; 108 | 109 | // noise for the planet 110 | float n = fbm(uv * size); 111 | float n2 = fbm(uv * size + n*3.0); 112 | float mixed = n2 * d_to_light; 113 | 114 | // optionally create some contrast with this 115 | // mixed = pow(mixed, 1.0); 116 | 117 | // apply dithering 118 | if (dith) { 119 | mixed *= 0.95; 120 | } 121 | 122 | // choose and apply colors 123 | float col_val = floor(mixed * 15.0) / 7.0; 124 | vec3 col = texture(colorscheme, vec2(col_val, 0.0)).rgb; 125 | 126 | // apply alpha 127 | float a = step(d_to_center, 0.5); 128 | COLOR = vec4(col, a); 129 | }" 130 | 131 | [sub_resource type="ShaderMaterial" id=2] 132 | shader = SubResource( 1 ) 133 | shader_param/size = 5.365 134 | shader_param/OCTAVES = 3 135 | shader_param/seed = 4.875 136 | shader_param/pixels = 500.0 137 | shader_param/light_origin = Vector2( 1.617, 0.637 ) 138 | shader_param/colorscheme = ExtResource( 2 ) 139 | 140 | [node name="Planet" type="Sprite"] 141 | material = SubResource( 2 ) 142 | texture = ExtResource( 1 ) 143 | script = ExtResource( 3 ) 144 | -------------------------------------------------------------------------------- /BackgroundGenerator/StarParticles.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="ShaderMaterial" load_steps=3 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=1] 4 | 5 | [sub_resource type="Shader" id=1] 6 | code = "shader_type particles; 7 | uniform vec3 direction; 8 | uniform float spread; 9 | uniform float flatness; 10 | uniform float initial_linear_velocity; 11 | uniform float initial_angle; 12 | uniform float angular_velocity; 13 | uniform float orbit_velocity; 14 | uniform float linear_accel; 15 | uniform float radial_accel; 16 | uniform float tangent_accel; 17 | uniform float damping; 18 | uniform float scale; 19 | uniform float hue_variation; 20 | uniform float anim_speed; 21 | uniform float anim_offset; 22 | uniform float initial_linear_velocity_random; 23 | uniform float initial_angle_random; 24 | uniform float angular_velocity_random; 25 | uniform float orbit_velocity_random; 26 | uniform float linear_accel_random; 27 | uniform float radial_accel_random; 28 | uniform float tangent_accel_random; 29 | uniform float damping_random; 30 | uniform float scale_random; 31 | uniform float hue_variation_random; 32 | uniform float anim_speed_random; 33 | uniform float anim_offset_random; 34 | uniform float lifetime_randomness; 35 | uniform vec3 emission_box_extents; 36 | uniform vec4 color_value : hint_color; 37 | uniform int trail_divisor; 38 | uniform vec3 gravity; 39 | uniform sampler2D color_ramp; 40 | uniform sampler2D colorscheme; 41 | 42 | float rand_from_seed(inout uint seed) { 43 | int k; 44 | int s = int(seed); 45 | if (s == 0) 46 | s = 305420679; 47 | k = s / 127773; 48 | s = 16807 * (s - k * 127773) - 2836 * k; 49 | if (s < 0) 50 | s += 2147483647; 51 | seed = uint(s); 52 | return float(seed % uint(65536)) / 65535.0; 53 | } 54 | 55 | float rand_from_seed_m1_p1(inout uint seed) { 56 | return rand_from_seed(seed) * 2.0 - 1.0; 57 | } 58 | 59 | uint hash(uint x) { 60 | x = ((x >> uint(16)) ^ x) * uint(73244475); 61 | x = ((x >> uint(16)) ^ x) * uint(73244475); 62 | x = (x >> uint(16)) ^ x; 63 | return x; 64 | } 65 | 66 | void vertex() { 67 | uint base_number = NUMBER / uint(trail_divisor); 68 | uint alt_seed = hash(base_number + uint(1) + RANDOM_SEED); 69 | float angle_rand = rand_from_seed(alt_seed); 70 | float scale_rand = rand_from_seed(alt_seed); 71 | float hue_rot_rand = rand_from_seed(alt_seed); 72 | float anim_offset_rand = rand_from_seed(alt_seed); 73 | float pi = 3.14159; 74 | float degree_to_rad = pi / 180.0; 75 | 76 | bool restart = false; 77 | if (CUSTOM.y > CUSTOM.w) { 78 | restart = true; 79 | } 80 | 81 | if (RESTART || restart) { 82 | float tex_linear_velocity = 0.0; 83 | float tex_angle = 0.0; 84 | float tex_anim_offset = 0.0; 85 | float spread_rad = spread * degree_to_rad; 86 | float angle1_rad = rand_from_seed_m1_p1(alt_seed) * spread_rad; 87 | angle1_rad += direction.x != 0.0 ? atan(direction.y, direction.x) : sign(direction.y) * (pi / 2.0); 88 | vec3 rot = vec3(cos(angle1_rad), sin(angle1_rad), 0.0); 89 | VELOCITY = rot * initial_linear_velocity * mix(1.0, rand_from_seed(alt_seed), initial_linear_velocity_random); 90 | float base_angle = (initial_angle + tex_angle) * mix(1.0, angle_rand, initial_angle_random); 91 | CUSTOM.x = base_angle * degree_to_rad; 92 | CUSTOM.y = 0.0; 93 | CUSTOM.w = (1.0 - lifetime_randomness * rand_from_seed(alt_seed)); 94 | CUSTOM.z = (anim_offset + tex_anim_offset) * mix(1.0, anim_offset_rand, anim_offset_random); 95 | TRANSFORM[3].xyz = vec3(rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0, rand_from_seed(alt_seed) * 2.0 - 1.0) * emission_box_extents; 96 | // TRANSFORM[3].xy = floor(TRANSFORM[3].xy) - vec2(0.5,0.5); 97 | VELOCITY = (EMISSION_TRANSFORM * vec4(VELOCITY, 0.0)).xyz; 98 | TRANSFORM = EMISSION_TRANSFORM * TRANSFORM; 99 | VELOCITY.z = 0.0; 100 | TRANSFORM[3].z = 0.0; 101 | } else { 102 | CUSTOM.y += DELTA / LIFETIME; 103 | float tex_linear_velocity = 0.0; 104 | float tex_orbit_velocity = 0.0; 105 | float tex_angular_velocity = 0.0; 106 | float tex_linear_accel = 0.0; 107 | float tex_radial_accel = 0.0; 108 | float tex_tangent_accel = 0.0; 109 | float tex_damping = 0.0; 110 | float tex_angle = 0.0; 111 | float tex_anim_speed = 0.0; 112 | float tex_anim_offset = 0.0; 113 | vec3 force = gravity; 114 | vec3 pos = TRANSFORM[3].xyz; 115 | pos.z = 0.0; 116 | // apply linear acceleration 117 | force += length(VELOCITY) > 0.0 ? normalize(VELOCITY) * (linear_accel + tex_linear_accel) * mix(1.0, rand_from_seed(alt_seed), linear_accel_random) : vec3(0.0); 118 | // apply radial acceleration 119 | vec3 org = EMISSION_TRANSFORM[3].xyz; 120 | vec3 diff = pos - org; 121 | force += length(diff) > 0.0 ? normalize(diff) * (radial_accel + tex_radial_accel) * mix(1.0, rand_from_seed(alt_seed), radial_accel_random) : vec3(0.0); 122 | // apply tangential acceleration; 123 | force += length(diff.yx) > 0.0 ? vec3(normalize(diff.yx * vec2(-1.0, 1.0)), 0.0) * ((tangent_accel + tex_tangent_accel) * mix(1.0, rand_from_seed(alt_seed), tangent_accel_random)) : vec3(0.0); 124 | // apply attractor forces 125 | VELOCITY += force * DELTA; 126 | // orbit velocity 127 | float orbit_amount = (orbit_velocity + tex_orbit_velocity) * mix(1.0, rand_from_seed(alt_seed), orbit_velocity_random); 128 | if (orbit_amount != 0.0) { 129 | float ang = orbit_amount * DELTA * pi * 2.0; 130 | mat2 rot = mat2(vec2(cos(ang), -sin(ang)), vec2(sin(ang), cos(ang))); 131 | TRANSFORM[3].xy -= diff.xy; 132 | TRANSFORM[3].xy += rot * diff.xy; 133 | } 134 | if (damping + tex_damping > 0.0) { 135 | float v = length(VELOCITY); 136 | float damp = (damping + tex_damping) * mix(1.0, rand_from_seed(alt_seed), damping_random); 137 | v -= damp * DELTA; 138 | if (v < 0.0) { 139 | VELOCITY = vec3(0.0); 140 | } else { 141 | VELOCITY = normalize(VELOCITY) * v; 142 | } 143 | } 144 | float base_angle = (initial_angle + tex_angle) * mix(1.0, angle_rand, initial_angle_random); 145 | base_angle += CUSTOM.y * LIFETIME * (angular_velocity + tex_angular_velocity) * mix(1.0, rand_from_seed(alt_seed) * 2.0 - 1.0, angular_velocity_random); 146 | CUSTOM.x = base_angle * degree_to_rad; 147 | CUSTOM.x = 2.0*pi * floor(rand_from_seed(alt_seed) * 4.0); 148 | CUSTOM.z = (anim_offset + tex_anim_offset) * mix(1.0, anim_offset_rand, anim_offset_random) + CUSTOM.y * (anim_speed + tex_anim_speed) * mix(1.0, rand_from_seed(alt_seed), anim_speed_random); 149 | } 150 | float tex_scale = 1.0; 151 | float tex_hue_variation = 0.0; 152 | float hue_rot_angle = (hue_variation + tex_hue_variation) * pi * 2.0 * mix(1.0, hue_rot_rand * 2.0 - 1.0, hue_variation_random); 153 | float hue_rot_c = cos(hue_rot_angle); 154 | float hue_rot_s = sin(hue_rot_angle); 155 | mat4 hue_rot_mat = mat4(vec4(0.299, 0.587, 0.114, 0.0), 156 | vec4(0.299, 0.587, 0.114, 0.0), 157 | vec4(0.299, 0.587, 0.114, 0.0), 158 | vec4(0.000, 0.000, 0.000, 1.0)) + 159 | mat4(vec4(0.701, -0.587, -0.114, 0.0), 160 | vec4(-0.299, 0.413, -0.114, 0.0), 161 | vec4(-0.300, -0.588, 0.886, 0.0), 162 | vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_c + 163 | mat4(vec4(0.168, 0.330, -0.497, 0.0), 164 | vec4(-0.328, 0.035, 0.292, 0.0), 165 | vec4(1.250, -1.050, -0.203, 0.0), 166 | vec4(0.000, 0.000, 0.000, 0.0)) * hue_rot_s; 167 | // vec4 tex_col = textureLod(color_ramp, vec2(CUSTOM.y, 0.0), 0.0); 168 | // COLOR = hue_rot_mat * tex_col; 169 | float col_value = floor(rand_from_seed(alt_seed) * 7.0) / 7.0; 170 | COLOR = textureLod(colorscheme, vec2(col_value, 0.0), 0.0); 171 | // COLOR.a *= pow(rand_from_seed(alt_seed), 2.0); 172 | 173 | TRANSFORM[0] = vec4(cos(CUSTOM.x), -sin(CUSTOM.x), 0.0, 0.0); 174 | TRANSFORM[1] = vec4(sin(CUSTOM.x), cos(CUSTOM.x), 0.0, 0.0); 175 | TRANSFORM[2] = vec4(0.0, 0.0, 1.0, 0.0); 176 | float base_scale = tex_scale * mix(scale, 1.0, scale_random * scale_rand); 177 | if (base_scale < 0.000001) { 178 | base_scale = 0.000001; 179 | } 180 | TRANSFORM[0].xyz *= base_scale; 181 | TRANSFORM[1].xyz *= base_scale; 182 | TRANSFORM[2].xyz *= base_scale; 183 | VELOCITY.z = 0.0; 184 | TRANSFORM[3].z = 0.0; 185 | 186 | if (CUSTOM.y > CUSTOM.w) { ACTIVE = false; 187 | } 188 | } 189 | 190 | " 191 | 192 | [resource] 193 | shader = SubResource( 1 ) 194 | shader_param/direction = Vector3( 1, 0, 0 ) 195 | shader_param/spread = 45.0 196 | shader_param/flatness = 0.0 197 | shader_param/initial_linear_velocity = 0.0 198 | shader_param/initial_angle = 0.0 199 | shader_param/angular_velocity = 0.0 200 | shader_param/orbit_velocity = 0.0 201 | shader_param/linear_accel = 0.0 202 | shader_param/radial_accel = 0.0 203 | shader_param/tangent_accel = 0.0 204 | shader_param/damping = 0.0 205 | shader_param/scale = 1.0 206 | shader_param/hue_variation = 0.0 207 | shader_param/anim_speed = 0.0 208 | shader_param/anim_offset = 1.0 209 | shader_param/initial_linear_velocity_random = 0.0 210 | shader_param/initial_angle_random = 0.0 211 | shader_param/angular_velocity_random = 0.0 212 | shader_param/orbit_velocity_random = 0.0 213 | shader_param/linear_accel_random = 0.0 214 | shader_param/radial_accel_random = 0.0 215 | shader_param/tangent_accel_random = 0.0 216 | shader_param/damping_random = 0.0 217 | shader_param/scale_random = 1.0 218 | shader_param/hue_variation_random = 0.0 219 | shader_param/anim_speed_random = 0.0 220 | shader_param/anim_offset_random = 1.0 221 | shader_param/lifetime_randomness = 0.0 222 | shader_param/emission_box_extents = Vector3( 50, 50, 1 ) 223 | shader_param/color_value = Color( 1, 1, 1, 1 ) 224 | shader_param/trail_divisor = 1 225 | shader_param/gravity = Vector3( 0, -1e-06, 0 ) 226 | shader_param/colorscheme = ExtResource( 1 ) 227 | -------------------------------------------------------------------------------- /BackgroundGenerator/StarStuff.shader: -------------------------------------------------------------------------------- 1 | shader_type canvas_item; 2 | render_mode blend_mix; 3 | 4 | uniform float size = 50.0; 5 | uniform int OCTAVES : hint_range(0, 20, 1); 6 | uniform float seed: hint_range(1, 10); 7 | uniform float pixels = 100.0; 8 | uniform bool should_tile = false; 9 | uniform bool reduce_background = false; 10 | uniform sampler2D colorscheme; 11 | uniform vec2 uv_correct = vec2(1.0); 12 | 13 | float rand(vec2 coord, float tilesize) { 14 | if (should_tile) { 15 | coord = mod(coord / uv_correct, tilesize ); 16 | } 17 | 18 | return fract(sin(dot(coord.xy ,vec2(12.9898,78.233))) * (15.5453 + seed)); 19 | } 20 | 21 | float noise(vec2 coord, float tilesize){ 22 | vec2 i = floor(coord); 23 | vec2 f = fract(coord); 24 | 25 | float a = rand(i, tilesize); 26 | float b = rand(i + vec2(1.0, 0.0), tilesize); 27 | float c = rand(i + vec2(0.0, 1.0), tilesize); 28 | float d = rand(i + vec2(1.0, 1.0), tilesize); 29 | 30 | vec2 cubic = f * f * (3.0 - 2.0 * f); 31 | 32 | return mix(a, b, cubic.x) + (c - a) * cubic.y * (1.0 - cubic.x) + (d - b) * cubic.x * cubic.y; 33 | } 34 | 35 | float fbm(vec2 coord, float tilesize){ 36 | float value = 0.0; 37 | float scale = 0.5; 38 | 39 | for(int i = 0; i < OCTAVES ; i++){ 40 | value += noise(coord, tilesize ) * scale; 41 | coord *= 2.0; 42 | scale *= 0.5; 43 | } 44 | return value; 45 | } 46 | 47 | bool dither(vec2 uv1, vec2 uv2) { 48 | return mod(uv1.y+uv2.x,2.0/pixels) <= 1.0 / pixels; 49 | } 50 | 51 | float circleNoise(vec2 uv, float tilesize) { 52 | if (should_tile) { 53 | uv = mod(uv, tilesize); 54 | } 55 | 56 | float uv_y = floor(uv.y); 57 | uv.x += uv_y*.31; 58 | vec2 f = fract(uv); 59 | float h = rand(vec2(floor(uv.x),floor(uv_y)), tilesize); 60 | float m = (length(f-0.25-(h*0.5))); 61 | float r = h*0.25; 62 | return smoothstep(0.0, r, m*0.75); 63 | } 64 | 65 | 66 | vec2 rotate(vec2 vec, float angle) { 67 | vec -=vec2(0.5); 68 | vec *= mat2(vec2(cos(angle),-sin(angle)), vec2(sin(angle),cos(angle))); 69 | vec += vec2(0.5); 70 | return vec; 71 | } 72 | 73 | float cloud_alpha(vec2 uv, float tilesize) { 74 | float c_noise = 0.0; 75 | 76 | // more iterations for more turbulence 77 | int iters = 2; 78 | for (int i = 0; i < iters; i++) { 79 | c_noise += circleNoise(uv * 0.5 + (float(i+1)) + vec2(-0.3, 0.0), ceil(tilesize * 0.5)); 80 | } 81 | float fbm = fbm(uv+c_noise, tilesize); 82 | 83 | return fbm; 84 | } 85 | 86 | void fragment() { 87 | // pixelizing and dithering 88 | vec2 uv = floor((UV) * pixels) / pixels * uv_correct; 89 | bool dith = dither(uv, UV); 90 | 91 | // noise for the dust 92 | // the + vec2(x,y) is to create an offset in noise values 93 | float n_alpha = fbm(uv * ceil(size * 0.5) +vec2(2,2), ceil(size * 0.5)); 94 | float n_dust = cloud_alpha(uv * size, size); 95 | float n_dust2 = fbm(uv * ceil(size * 0.2) -vec2(2,2),ceil(size * 0.2)); 96 | float n_dust_lerp = n_dust2 * n_dust; 97 | 98 | // apply dithering 99 | if (dith) { 100 | n_dust_lerp *= 0.95; 101 | } 102 | 103 | // choose alpha value 104 | float a_dust = step(n_alpha , n_dust_lerp * 1.8); 105 | n_dust_lerp = pow(n_dust_lerp, 3.2) * 56.0; 106 | if (dith) { 107 | n_dust_lerp *= 1.1; 108 | } 109 | 110 | // choose & apply colors 111 | if (reduce_background) { 112 | n_dust_lerp = pow(n_dust_lerp, 0.8) * 0.7; 113 | } 114 | 115 | float col_value = floor(n_dust_lerp) / 7.0; 116 | vec3 col = texture(colorscheme, vec2(col_value, 0.0)).rgb; 117 | 118 | 119 | 120 | COLOR = vec4(col, a_dust); 121 | } -------------------------------------------------------------------------------- /BackgroundGenerator/StarStuff.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="ShaderMaterial" load_steps=3 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/Colorscheme.tres" type="Texture" id=1] 4 | [ext_resource path="res://BackgroundGenerator/StarStuff.shader" type="Shader" id=2] 5 | 6 | [resource] 7 | shader = ExtResource( 2 ) 8 | shader_param/size = 10.0 9 | shader_param/OCTAVES = 8 10 | shader_param/seed = 6.521 11 | shader_param/pixels = 500.0 12 | shader_param/should_tile = false 13 | shader_param/reduce_background = false 14 | shader_param/uv_correct = Vector2( 1, 1 ) 15 | shader_param/colorscheme = ExtResource( 1 ) 16 | -------------------------------------------------------------------------------- /BackgroundGenerator/stars-special.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/BackgroundGenerator/stars-special.png -------------------------------------------------------------------------------- /BackgroundGenerator/stars-special.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/stars-special.png-469ab6a6cb3bdbfaead67c19f29ce0bb.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://BackgroundGenerator/stars-special.png" 13 | dest_files=[ "res://.import/stars-special.png-469ab6a6cb3bdbfaead67c19f29ce0bb.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=false 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /BackgroundGenerator/stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/BackgroundGenerator/stars.png -------------------------------------------------------------------------------- /BackgroundGenerator/stars.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/stars.png-a179f27cfdc9b6133065fee9c594b7f1.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://BackgroundGenerator/stars.png" 13 | dest_files=[ "res://.import/stars.png-a179f27cfdc9b6133065fee9c594b7f1.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=false 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /GUI/ColorPickerButton.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [sub_resource type="StyleBoxFlat" id=1] 4 | bg_color = Color( 1, 1, 1, 1 ) 5 | 6 | [node name="Button" type="Button"] 7 | margin_right = 382.0 8 | margin_bottom = 26.0 9 | size_flags_horizontal = 3 10 | custom_styles/hover = SubResource( 1 ) 11 | custom_styles/pressed = SubResource( 1 ) 12 | custom_styles/normal = SubResource( 1 ) 13 | -------------------------------------------------------------------------------- /GUI/Font.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="DynamicFont" load_steps=2 format=2] 2 | 3 | [ext_resource path="res://GUI/slkscre.ttf" type="DynamicFontData" id=1] 4 | 5 | [resource] 6 | size = 25 7 | font_data = ExtResource( 1 ) 8 | -------------------------------------------------------------------------------- /GUI/FontSmall.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="DynamicFont" load_steps=2 format=2] 2 | 3 | [ext_resource path="res://GUI/slkscre.ttf" type="DynamicFontData" id=1] 4 | 5 | [resource] 6 | size = 25 7 | extra_spacing_char = -5 8 | font_data = ExtResource( 1 ) 9 | -------------------------------------------------------------------------------- /GUI/FontSmaller.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="DynamicFont" load_steps=2 format=2] 2 | 3 | [ext_resource path="res://GUI/slkscre.ttf" type="DynamicFontData" id=1] 4 | 5 | [resource] 6 | size = 17 7 | extra_spacing_top = 4 8 | extra_spacing_bottom = 2 9 | extra_spacing_char = -3 10 | font_data = ExtResource( 1 ) 11 | -------------------------------------------------------------------------------- /GUI/GUI.gd: -------------------------------------------------------------------------------- 1 | extends Control 2 | 3 | 4 | onready var generator = $Viewport/BackgroundGenerator 5 | onready var viewport = $Viewport 6 | onready var global_scheme = preload("res://BackgroundGenerator/Colorscheme.tres") 7 | 8 | var new_size = Vector2(200,200) 9 | 10 | func _ready(): 11 | randomize() 12 | _generate_new() 13 | 14 | func _generate_new(): 15 | $Viewport.size = new_size 16 | generator.rect_min_size = new_size 17 | generator.rect_size = new_size 18 | generator.set_mirror_size(new_size) 19 | $Viewport/Camera1.zoom = new_size/viewport.size 20 | $Viewport/Camera1.offset = new_size * 0.5 21 | 22 | var aspect = Vector2(1,1) 23 | if new_size.x > new_size.y: 24 | aspect = Vector2(new_size.y / new_size.x, 1.0) 25 | else: 26 | aspect = Vector2(1.0, new_size.x / new_size.y) 27 | 28 | $HBoxContainer/Control/TextureRect.rect_size = aspect * 600 29 | 30 | yield(get_tree(), "idle_frame") 31 | $HBoxContainer/Control/TextureRect.rect_size = Vector2(600,600) 32 | generator.generate_new() 33 | 34 | func _on_NewButton_pressed(): 35 | _generate_new() 36 | 37 | func _on_ExportButton_pressed(): 38 | $Viewport/Camera1.current = false 39 | $Viewport/Camera2.current = true 40 | $SaveTimer.start() 41 | 42 | func export_image(): 43 | var img = Image.new() 44 | img.create(new_size.x, new_size.y, false, Image.FORMAT_RGBA8) 45 | var viewport_img = viewport.get_texture().get_data() 46 | 47 | img.blit_rect(viewport_img, Rect2(0,0,new_size.x,new_size.y), Vector2(0,0)) 48 | 49 | save_image(img) 50 | 51 | func save_image(img): 52 | if OS.get_name() == "HTML5" and OS.has_feature('JavaScript'): 53 | var filesaver = get_tree().root.get_node("/root/HTML5File") 54 | filesaver.save_image(img, "Space Background") 55 | else: 56 | img.save_png("res://Space Background.png") 57 | 58 | func _on_SaveTimer_timeout(): 59 | export_image() 60 | $Viewport/Camera1.current = true 61 | $Viewport/Camera2.current = false 62 | 63 | func select_colorscheme(scheme): 64 | $Viewport/BackgroundGenerator.set_background_color(scheme[0]) 65 | scheme.remove(0) 66 | global_scheme.gradient.colors = scheme 67 | 68 | func _on_EnableStars_pressed(): 69 | generator.toggle_stars() 70 | 71 | func _on_EnableDust_pressed(): 72 | generator.toggle_dust() 73 | 74 | func _on_EnableNebulae_pressed(): 75 | generator.toggle_nebulae() 76 | 77 | func _on_EnablePlanets_pressed(): 78 | generator.toggle_planets() 79 | 80 | func _on_EnableReduceBackground_pressed(): 81 | generator.toggle_reduce_background() 82 | 83 | func _on_EnableTile_pressed(): 84 | generator.toggle_tile() 85 | 86 | func _on_PixelsHeight_value_changed(value): 87 | value = clamp(value, 100, 3000) 88 | new_size.y = int(value) 89 | 90 | func _on_PixelsWidth_value_changed(value): 91 | value = clamp(value, 100, 3000) 92 | new_size.x = int(value) 93 | 94 | 95 | func _on_EnableTransparency_pressed(): 96 | generator.toggle_transparancy() 97 | -------------------------------------------------------------------------------- /GUI/GUI.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=12 format=2] 2 | 3 | [ext_resource path="res://BackgroundGenerator/BackgroundGenerator.tscn" type="PackedScene" id=1] 4 | [ext_resource path="res://GUI/GUI.gd" type="Script" id=2] 5 | [ext_resource path="res://GUI/SchemeSelectButton.tscn" type="PackedScene" id=3] 6 | [ext_resource path="res://GUI/Theme.tres" type="Theme" id=4] 7 | [ext_resource path="res://GUI/slkscre.ttf" type="DynamicFontData" id=5] 8 | [ext_resource path="res://GUI/FontSmall.tres" type="DynamicFont" id=6] 9 | [ext_resource path="res://GUI/FontSmaller.tres" type="DynamicFont" id=7] 10 | [ext_resource path="res://GUI/transparent.png" type="Texture" id=8] 11 | 12 | [sub_resource type="ViewportTexture" id=1] 13 | viewport_path = NodePath("Viewport") 14 | 15 | [sub_resource type="DynamicFont" id=2] 16 | size = 17 17 | extra_spacing_top = 4 18 | extra_spacing_bottom = 2 19 | extra_spacing_char = -3 20 | font_data = ExtResource( 5 ) 21 | 22 | [sub_resource type="StyleBoxFlat" id=3] 23 | bg_color = Color( 0.305882, 0.286275, 0.372549, 1 ) 24 | 25 | [node name="GUI" type="Control"] 26 | anchor_right = 1.0 27 | anchor_bottom = 1.0 28 | theme = ExtResource( 4 ) 29 | script = ExtResource( 2 ) 30 | __meta__ = { 31 | "_edit_use_anchors_": false 32 | } 33 | 34 | [node name="Viewport" type="Viewport" parent="."] 35 | size = Vector2( 3000, 3000 ) 36 | own_world = true 37 | transparent_bg = true 38 | hdr = false 39 | disable_3d = true 40 | usage = 1 41 | render_target_v_flip = true 42 | gui_snap_controls_to_pixels = false 43 | 44 | [node name="BackgroundGenerator" parent="Viewport" instance=ExtResource( 1 )] 45 | 46 | [node name="Camera1" type="Camera2D" parent="Viewport"] 47 | offset = Vector2( 50, 50 ) 48 | current = true 49 | zoom = Vector2( 0.1, 0.1 ) 50 | 51 | [node name="Camera2" type="Camera2D" parent="Viewport"] 52 | anchor_mode = 0 53 | 54 | [node name="HBoxContainer" type="HBoxContainer" parent="."] 55 | anchor_right = 1.0 56 | anchor_bottom = 1.0 57 | custom_constants/separation = 0 58 | __meta__ = { 59 | "_edit_use_anchors_": false 60 | } 61 | 62 | [node name="Control" type="Control" parent="HBoxContainer"] 63 | margin_right = 600.0 64 | margin_bottom = 600.0 65 | rect_min_size = Vector2( 600, 600 ) 66 | 67 | [node name="ColorRect" type="ColorRect" parent="HBoxContainer/Control"] 68 | visible = false 69 | anchor_right = 1.0 70 | anchor_bottom = 1.0 71 | color = Color( 0.0313726, 0.0784314, 0.117647, 1 ) 72 | __meta__ = { 73 | "_edit_use_anchors_": false 74 | } 75 | 76 | [node name="TextureRect2" type="TextureRect" parent="HBoxContainer/Control"] 77 | anchor_right = 1.0 78 | anchor_bottom = 1.0 79 | texture = ExtResource( 8 ) 80 | stretch_mode = 2 81 | __meta__ = { 82 | "_edit_use_anchors_": false 83 | } 84 | 85 | [node name="TextureRect" type="TextureRect" parent="HBoxContainer/Control"] 86 | anchor_right = 1.0 87 | anchor_bottom = 1.0 88 | texture = SubResource( 1 ) 89 | expand = true 90 | stretch_mode = 6 91 | __meta__ = { 92 | "_edit_use_anchors_": false 93 | } 94 | 95 | [node name="ColorRect" type="ColorRect" parent="HBoxContainer"] 96 | margin_left = 600.0 97 | margin_right = 1062.0 98 | margin_bottom = 600.0 99 | size_flags_horizontal = 3 100 | size_flags_vertical = 3 101 | color = Color( 0.0313726, 0.0784314, 0.117647, 1 ) 102 | 103 | [node name="Settings" type="VBoxContainer" parent="HBoxContainer/ColorRect"] 104 | anchor_right = 1.0 105 | anchor_bottom = 1.0 106 | margin_left = 10.0 107 | margin_top = 10.0 108 | margin_right = -10.0 109 | margin_bottom = -10.0 110 | size_flags_horizontal = 3 111 | size_flags_vertical = 3 112 | custom_constants/separation = 2 113 | __meta__ = { 114 | "_edit_use_anchors_": false 115 | } 116 | 117 | [node name="NewButton" type="Button" parent="HBoxContainer/ColorRect/Settings"] 118 | margin_right = 442.0 119 | margin_bottom = 26.0 120 | text = "new image" 121 | 122 | [node name="Spacer" type="Control" parent="HBoxContainer/ColorRect/Settings"] 123 | margin_top = 28.0 124 | margin_right = 442.0 125 | margin_bottom = 33.0 126 | rect_min_size = Vector2( 0, 5 ) 127 | 128 | [node name="Label" type="Label" parent="HBoxContainer/ColorRect/Settings"] 129 | margin_top = 35.0 130 | margin_right = 442.0 131 | margin_bottom = 61.0 132 | text = "Size (Pixels):" 133 | 134 | [node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/ColorRect/Settings"] 135 | margin_top = 63.0 136 | margin_right = 442.0 137 | margin_bottom = 89.0 138 | __meta__ = { 139 | "_edit_use_anchors_": false 140 | } 141 | 142 | [node name="Label" type="Label" parent="HBoxContainer/ColorRect/Settings/HBoxContainer"] 143 | margin_right = 219.0 144 | margin_bottom = 26.0 145 | size_flags_horizontal = 3 146 | text = "width:" 147 | 148 | [node name="PixelsWidth" type="SpinBox" parent="HBoxContainer/ColorRect/Settings/HBoxContainer"] 149 | margin_left = 223.0 150 | margin_right = 442.0 151 | margin_bottom = 26.0 152 | size_flags_horizontal = 3 153 | min_value = 100.0 154 | max_value = 3000.0 155 | value = 200.0 156 | 157 | [node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer/ColorRect/Settings"] 158 | margin_top = 91.0 159 | margin_right = 442.0 160 | margin_bottom = 117.0 161 | __meta__ = { 162 | "_edit_use_anchors_": false 163 | } 164 | 165 | [node name="Label" type="Label" parent="HBoxContainer/ColorRect/Settings/HBoxContainer2"] 166 | margin_right = 219.0 167 | margin_bottom = 26.0 168 | size_flags_horizontal = 3 169 | text = "height:" 170 | 171 | [node name="PixelsHeight" type="SpinBox" parent="HBoxContainer/ColorRect/Settings/HBoxContainer2"] 172 | margin_left = 223.0 173 | margin_right = 442.0 174 | margin_bottom = 26.0 175 | size_flags_horizontal = 3 176 | min_value = 100.0 177 | max_value = 3000.0 178 | value = 200.0 179 | 180 | [node name="Spacer2" type="Control" parent="HBoxContainer/ColorRect/Settings"] 181 | margin_top = 119.0 182 | margin_right = 442.0 183 | margin_bottom = 124.0 184 | rect_min_size = Vector2( 0, 5 ) 185 | 186 | [node name="Label2" type="Label" parent="HBoxContainer/ColorRect/Settings"] 187 | margin_top = 126.0 188 | margin_right = 442.0 189 | margin_bottom = 152.0 190 | text = "colorscheme:" 191 | 192 | [node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer/ColorRect/Settings"] 193 | margin_top = 154.0 194 | margin_right = 442.0 195 | margin_bottom = 419.0 196 | rect_min_size = Vector2( 0, 50 ) 197 | size_flags_vertical = 3 198 | 199 | [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/ColorRect/Settings/ScrollContainer"] 200 | margin_right = 430.0 201 | margin_bottom = 356.0 202 | size_flags_horizontal = 3 203 | custom_constants/separation = 2 204 | 205 | [node name="Button" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 206 | margin_right = 430.0 207 | custom_fonts/font = ExtResource( 6 ) 208 | text = "NYX8" 209 | colorscheme = PoolColorArray( 0.00392157, 0.0352941, 0.0588235, 1, 0.0313726, 0.0784314, 0.117647, 1, 0.0588235, 0.164706, 0.247059, 1, 0.12549, 0.223529, 0.309804, 1, 0.305882, 0.286275, 0.372549, 1, 0.505882, 0.384314, 0.443137, 1, 0.6, 0.458824, 0.466667, 1, 0.764706, 0.639216, 0.541176, 1, 0.964706, 0.839216, 0.741176, 1 ) 210 | 211 | [node name="Button4" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 212 | margin_top = 28.0 213 | margin_right = 430.0 214 | margin_bottom = 54.0 215 | custom_fonts/font = ExtResource( 6 ) 216 | text = "AMMO-8" 217 | colorscheme = PoolColorArray( 0, 0.0392157, 0.0117647, 1, 0.0156863, 0.0470588, 0.0235294, 1, 0.0666667, 0.137255, 0.0941176, 1, 0.117647, 0.227451, 0.160784, 1, 0.188235, 0.364706, 0.258824, 1, 0.301961, 0.501961, 0.380392, 1, 0.537255, 0.635294, 0.341176, 1, 0.745098, 0.862745, 0.498039, 1, 0.933333, 1, 0.8, 1 ) 218 | 219 | [node name="Button9" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 220 | margin_top = 56.0 221 | margin_right = 430.0 222 | margin_bottom = 80.0 223 | custom_fonts/font = ExtResource( 7 ) 224 | text = "winter wonderland" 225 | colorscheme = PoolColorArray( 0.0666667, 0.0941176, 0.215686, 1, 0.12549, 0.156863, 0.305882, 1, 0.172549, 0.290196, 0.470588, 1, 0.219608, 0.458824, 0.631373, 1, 0.545098, 0.792157, 0.866667, 1, 0.45098, 0.552941, 0.615686, 1, 0.654902, 0.737255, 0.788235, 1, 0.839216, 0.882353, 0.913725, 1, 1, 1, 1, 1 ) 226 | 227 | [node name="Button11" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 228 | margin_top = 82.0 229 | margin_right = 430.0 230 | margin_bottom = 108.0 231 | custom_fonts/font = ExtResource( 6 ) 232 | text = "borkfest" 233 | colorscheme = PoolColorArray( 0.0901961, 0.0901961, 0.0666667, 1, 0.12549, 0.133333, 0.0823529, 1, 0.227451, 0.156863, 0.00784314, 1, 0.588235, 0.235294, 0.235294, 1, 0.792157, 0.352941, 0.180392, 1, 1, 0.470588, 0.192157, 1, 0.952941, 0.6, 0.286275, 1, 0.921569, 0.760784, 0.458824, 1, 0.87451, 0.843137, 0.521569, 1 ) 234 | 235 | [node name="Button10" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 236 | margin_top = 110.0 237 | margin_right = 430.0 238 | margin_bottom = 134.0 239 | custom_fonts/font = SubResource( 2 ) 240 | text = "submerged chimera" 241 | colorscheme = PoolColorArray( 0.0196078, 0.00784314, 0.0980392, 1, 0.0705882, 0.0588235, 0.156863, 1, 0.180392, 0.117647, 0.360784, 1, 0.427451, 0.258824, 0.6, 1, 0.52549, 0.137255, 0.682353, 1, 0.870588, 0.223529, 0.913725, 1, 0.968627, 0.572549, 0.894118, 1, 1, 0.823529, 0.870588, 1, 0.968627, 0.980392, 0.917647, 1 ) 242 | 243 | [node name="Button6" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 244 | margin_top = 136.0 245 | margin_right = 430.0 246 | margin_bottom = 162.0 247 | custom_fonts/font = ExtResource( 6 ) 248 | text = "DREAMSCAPE8" 249 | colorscheme = PoolColorArray( 0.129412, 0.0980392, 0.129412, 1, 0.329412, 0.2, 0.266667, 1, 0.545098, 0.25098, 0.286275, 1, 0.682353, 0.415686, 0.278431, 1, 0.792157, 0.627451, 0.352941, 1, 0.317647, 0.321569, 0.384314, 1, 0.388235, 0.470588, 0.490196, 1, 0.556863, 0.627451, 0.568627, 1, 0.788235, 0.8, 0.631373, 1 ) 250 | 251 | [node name="Button8" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 252 | margin_top = 164.0 253 | margin_right = 430.0 254 | margin_bottom = 190.0 255 | custom_fonts/font = ExtResource( 6 ) 256 | text = "coffee" 257 | colorscheme = PoolColorArray( 0, 0, 0, 1, 0, 0, 0, 1, 0.0392157, 0.0392157, 0.0392157, 1, 0.0980392, 0.0980392, 0.0980392, 1, 0.32549, 0.243137, 0.176471, 1, 0.635294, 0.439216, 0.207843, 1, 0.721569, 0.545098, 0.290196, 1, 0.866667, 0.792157, 0.490196, 1, 0.984314, 0.976471, 0.937255, 1 ) 258 | 259 | [node name="Button5" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 260 | margin_top = 192.0 261 | margin_right = 430.0 262 | margin_bottom = 218.0 263 | custom_fonts/font = ExtResource( 6 ) 264 | text = "FUNKYFUTURE8" 265 | colorscheme = PoolColorArray( 0.0705882, 0.0313726, 0.14902, 1, 0.168627, 0.0588235, 0.329412, 1, 0.670588, 0.121569, 0.396078, 1, 1, 0.309804, 0.411765, 1, 1, 0.505882, 0.258824, 1, 1, 0.854902, 0.270588, 1, 0.2, 0.407843, 0.862745, 1, 0.286275, 0.905882, 0.92549, 1, 1, 0.968627, 0.972549, 1 ) 266 | 267 | [node name="Button3" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 268 | margin_top = 220.0 269 | margin_right = 430.0 270 | margin_bottom = 246.0 271 | custom_fonts/font = ExtResource( 6 ) 272 | text = "POLLEN8" 273 | colorscheme = PoolColorArray( 0.180392, 0.141176, 0.164706, 1, 0.45098, 0.27451, 0.298039, 1, 0.670588, 0.337255, 0.458824, 1, 0.933333, 0.415686, 0.486275, 1, 1, 0.654902, 0.647059, 1, 0.203922, 0.67451, 0.729412, 1, 0.447059, 0.862745, 0.733333, 1, 1, 0.878431, 0.494118, 1, 1, 0.905882, 0.839216, 1 ) 274 | 275 | [node name="Button7" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 276 | margin_top = 248.0 277 | margin_right = 430.0 278 | margin_bottom = 274.0 279 | custom_fonts/font = ExtResource( 6 ) 280 | text = "Rust gold 8" 281 | colorscheme = PoolColorArray( 0.0313726, 0.0784314, 0.117647, 1, 0.12549, 0.12549, 0.12549, 1, 0.223529, 0.223529, 0.223529, 1, 0.447059, 0.34902, 0.337255, 1, 0.733333, 0.498039, 0.341176, 1, 0.2, 0.109804, 0.0901961, 1, 0.337255, 0.196078, 0.14902, 1, 0.67451, 0.419608, 0.14902, 1, 0.964706, 0.803922, 0.14902, 1 ) 282 | 283 | [node name="Button2" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 284 | margin_top = 276.0 285 | margin_right = 430.0 286 | margin_bottom = 302.0 287 | custom_fonts/font = ExtResource( 6 ) 288 | text = "SLSO8" 289 | colorscheme = PoolColorArray( 0, 0.0901961, 0.168627, 1, 0.0509804, 0.168627, 0.270588, 1, 0.12549, 0.235294, 0.337255, 1, 0.329412, 0.305882, 0.407843, 1, 0.552941, 0.411765, 0.478431, 1, 0.815686, 0.505882, 0.34902, 1, 1, 0.666667, 0.368627, 1, 1, 0.831373, 0.639216, 1, 1, 0.92549, 0.839216, 1 ) 290 | 291 | [node name="Button12" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 292 | margin_top = 304.0 293 | margin_right = 430.0 294 | margin_bottom = 328.0 295 | custom_fonts/font = ExtResource( 7 ) 296 | text = "Goosebumps gold" 297 | colorscheme = PoolColorArray( 0, 0.00784314, 0.0156863, 1, 0.129412, 0.0980392, 0.109804, 1, 0.215686, 0.137255, 0.396078, 1, 0.25098, 0.294118, 0.466667, 1, 0.352941, 0.521569, 0.643137, 1, 0.580392, 0.0784314, 0.203922, 1, 0.784314, 0.129412, 0.0313726, 1, 0.890196, 0.364706, 0.0313726, 1, 0.819608, 0.623529, 0.133333, 1 ) 298 | 299 | [node name="Button13" parent="HBoxContainer/ColorRect/Settings/ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] 300 | margin_top = 330.0 301 | margin_right = 430.0 302 | margin_bottom = 356.0 303 | custom_fonts/font = ExtResource( 6 ) 304 | text = "OIL6" 305 | colorscheme = PoolColorArray( 0.0228, 0.0228, 0.04, 1, 0.0666667, 0.0666667, 0.121569, 1, 0.113725, 0.113725, 0.2, 1, 0.152941, 0.152941, 0.266667, 1, 0.286275, 0.301961, 0.494118, 1, 0.545098, 0.427451, 0.611765, 1, 0.776471, 0.623529, 0.647059, 1, 0.94902, 0.827451, 0.670588, 1, 0.984314, 0.960784, 0.937255, 1 ) 306 | 307 | [node name="Spacer3" type="Control" parent="HBoxContainer/ColorRect/Settings"] 308 | margin_top = 421.0 309 | margin_right = 442.0 310 | margin_bottom = 426.0 311 | rect_min_size = Vector2( 0, 5 ) 312 | 313 | [node name="GridContainer" type="GridContainer" parent="HBoxContainer/ColorRect/Settings"] 314 | margin_top = 428.0 315 | margin_right = 442.0 316 | margin_bottom = 514.0 317 | columns = 2 318 | 319 | [node name="EnableStars" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 320 | margin_right = 219.0 321 | margin_bottom = 26.0 322 | size_flags_horizontal = 3 323 | custom_styles/hover_pressed = SubResource( 3 ) 324 | pressed = true 325 | text = "stars" 326 | 327 | [node name="EnableDust" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 328 | margin_left = 223.0 329 | margin_right = 442.0 330 | margin_bottom = 26.0 331 | size_flags_horizontal = 3 332 | custom_styles/hover_pressed = SubResource( 3 ) 333 | pressed = true 334 | text = "dust" 335 | 336 | [node name="EnableNebulae" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 337 | margin_top = 30.0 338 | margin_right = 219.0 339 | margin_bottom = 56.0 340 | custom_styles/hover_pressed = SubResource( 3 ) 341 | pressed = true 342 | text = "nebulae" 343 | 344 | [node name="EnablePlanets" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 345 | margin_left = 223.0 346 | margin_top = 30.0 347 | margin_right = 442.0 348 | margin_bottom = 56.0 349 | custom_styles/hover_pressed = SubResource( 3 ) 350 | pressed = true 351 | text = "planets" 352 | 353 | [node name="EnableTile" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 354 | margin_top = 60.0 355 | margin_right = 219.0 356 | margin_bottom = 86.0 357 | custom_styles/hover_pressed = SubResource( 3 ) 358 | text = "tile" 359 | 360 | [node name="EnableReduceBackground" type="CheckBox" parent="HBoxContainer/ColorRect/Settings/GridContainer"] 361 | margin_left = 223.0 362 | margin_top = 60.0 363 | margin_right = 442.0 364 | margin_bottom = 86.0 365 | custom_styles/hover_pressed = SubResource( 3 ) 366 | text = "darken" 367 | 368 | [node name="Spacer5" type="Control" parent="HBoxContainer/ColorRect/Settings"] 369 | margin_top = 516.0 370 | margin_right = 442.0 371 | margin_bottom = 517.0 372 | rect_min_size = Vector2( 0, 1 ) 373 | 374 | [node name="EnableTransparency" type="CheckBox" parent="HBoxContainer/ColorRect/Settings"] 375 | margin_top = 519.0 376 | margin_right = 442.0 377 | margin_bottom = 545.0 378 | custom_styles/hover_pressed = SubResource( 3 ) 379 | text = "Transparency" 380 | 381 | [node name="Spacer4" type="Control" parent="HBoxContainer/ColorRect/Settings"] 382 | margin_top = 547.0 383 | margin_right = 442.0 384 | margin_bottom = 552.0 385 | rect_min_size = Vector2( 0, 5 ) 386 | 387 | [node name="ExportButton" type="Button" parent="HBoxContainer/ColorRect/Settings"] 388 | margin_top = 554.0 389 | margin_right = 442.0 390 | margin_bottom = 580.0 391 | text = "export" 392 | 393 | [node name="SaveTimer" type="Timer" parent="."] 394 | wait_time = 0.1 395 | one_shot = true 396 | 397 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/NewButton" to="." method="_on_NewButton_pressed"] 398 | [connection signal="value_changed" from="HBoxContainer/ColorRect/Settings/HBoxContainer/PixelsWidth" to="." method="_on_PixelsWidth_value_changed"] 399 | [connection signal="value_changed" from="HBoxContainer/ColorRect/Settings/HBoxContainer2/PixelsHeight" to="." method="_on_PixelsHeight_value_changed"] 400 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnableStars" to="." method="_on_EnableStars_pressed"] 401 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnableDust" to="." method="_on_EnableDust_pressed"] 402 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnableNebulae" to="." method="_on_EnableNebulae_pressed"] 403 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnablePlanets" to="." method="_on_EnablePlanets_pressed"] 404 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnableTile" to="." method="_on_EnableTile_pressed"] 405 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/GridContainer/EnableReduceBackground" to="." method="_on_EnableReduceBackground_pressed"] 406 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/EnableTransparency" to="." method="_on_EnableTransparency_pressed"] 407 | [connection signal="pressed" from="HBoxContainer/ColorRect/Settings/ExportButton" to="." method="_on_ExportButton_pressed"] 408 | [connection signal="timeout" from="SaveTimer" to="." method="_on_SaveTimer_timeout"] 409 | -------------------------------------------------------------------------------- /GUI/SchemeSelectButton.gd: -------------------------------------------------------------------------------- 1 | extends Button 2 | 3 | export (PoolColorArray) var colorscheme 4 | onready var colorbutton_scene = preload("res://GUI/ColorPickerButton.tscn") 5 | 6 | func _ready(): 7 | for i in colorscheme.size(): 8 | var b = ColorPickerButton.new() 9 | 10 | b.color = colorscheme[i] 11 | b.size_flags_horizontal = SIZE_EXPAND_FILL 12 | b.connect("color_changed", self, "_on_color_changed", [i]) 13 | $HBoxContainer.add_child(b) 14 | 15 | func _on_color_changed(color, index): 16 | colorscheme[index] = color 17 | get_tree().root.get_node("GUI").select_colorscheme(colorscheme) 18 | 19 | func _on_Button_pressed(): 20 | get_tree().root.get_node("GUI").select_colorscheme(colorscheme) 21 | -------------------------------------------------------------------------------- /GUI/SchemeSelectButton.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://GUI/SchemeSelectButton.gd" type="Script" id=1] 4 | 5 | [node name="Button" type="Button"] 6 | margin_right = 442.0 7 | margin_bottom = 26.0 8 | size_flags_horizontal = 3 9 | align = 0 10 | script = ExtResource( 1 ) 11 | __meta__ = { 12 | "_edit_use_anchors_": false 13 | } 14 | 15 | [node name="HBoxContainer" type="HBoxContainer" parent="."] 16 | anchor_right = 1.0 17 | anchor_bottom = 1.0 18 | margin_left = 190.0 19 | custom_constants/separation = 0 20 | __meta__ = { 21 | "_edit_use_anchors_": false 22 | } 23 | [connection signal="pressed" from="." to="." method="_on_Button_pressed"] 24 | -------------------------------------------------------------------------------- /GUI/Theme.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Theme" load_steps=22 format=2] 2 | 3 | [ext_resource path="res://GUI/empty.png" type="Texture" id=1] 4 | [ext_resource path="res://GUI/grabber-highlight.png" type="Texture" id=2] 5 | [ext_resource path="res://GUI/grabber.png" type="Texture" id=3] 6 | [ext_resource path="res://GUI/Font.tres" type="DynamicFont" id=4] 7 | [ext_resource path="res://GUI/slkscre.ttf" type="DynamicFontData" id=5] 8 | 9 | [sub_resource type="StyleBoxFlat" id=1] 10 | bg_color = Color( 0.305882, 0.286275, 0.372549, 1 ) 11 | 12 | [sub_resource type="StyleBoxFlat" id=2] 13 | bg_color = Color( 0.764706, 0.639216, 0.541176, 1 ) 14 | 15 | [sub_resource type="StyleBoxFlat" id=3] 16 | bg_color = Color( 0.764706, 0.639216, 0.541176, 1 ) 17 | 18 | [sub_resource type="StyleBoxFlat" id=4] 19 | bg_color = Color( 0.305882, 0.286275, 0.372549, 1 ) 20 | 21 | [sub_resource type="StyleBoxFlat" id=5] 22 | bg_color = Color( 0.764706, 0.639216, 0.541176, 1 ) 23 | 24 | [sub_resource type="DynamicFont" id=6] 25 | size = 8 26 | font_data = ExtResource( 5 ) 27 | 28 | [sub_resource type="StyleBoxFlat" id=7] 29 | bg_color = Color( 0, 0, 0, 1 ) 30 | border_width_left = 1 31 | border_width_top = 1 32 | border_width_right = 1 33 | border_width_bottom = 1 34 | border_color = Color( 1, 1, 1, 1 ) 35 | 36 | [sub_resource type="StyleBoxFlat" id=8] 37 | bg_color = Color( 1, 1, 1, 1 ) 38 | border_width_left = 1 39 | border_width_top = 1 40 | border_width_right = 1 41 | border_width_bottom = 1 42 | border_color = Color( 0, 0, 0, 1 ) 43 | 44 | [sub_resource type="StyleBoxFlat" id=9] 45 | bg_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 46 | border_width_top = 16 47 | border_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 48 | 49 | [sub_resource type="StyleBoxFlat" id=10] 50 | bg_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 51 | border_width_top = 16 52 | border_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 53 | 54 | [sub_resource type="StyleBoxFlat" id=11] 55 | border_width_bottom = 14 56 | border_color = Color( 0, 0, 0, 1 ) 57 | 58 | [sub_resource type="StyleBoxFlat" id=12] 59 | bg_color = Color( 0.0313726, 0.0784314, 0.117647, 1 ) 60 | 61 | [sub_resource type="StyleBoxFlat" id=13] 62 | bg_color = Color( 0, 0, 0, 1 ) 63 | 64 | [sub_resource type="StyleBoxFlat" id=14] 65 | bg_color = Color( 0, 0, 0, 1 ) 66 | 67 | [sub_resource type="StyleBoxFlat" id=15] 68 | bg_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 69 | 70 | [sub_resource type="StyleBoxFlat" id=16] 71 | bg_color = Color( 0, 0, 0, 1 ) 72 | 73 | [resource] 74 | default_font = ExtResource( 4 ) 75 | Button/colors/font_color = Color( 0.0588235, 0.164706, 0.247059, 1 ) 76 | Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) 77 | Button/colors/font_color_hover = Color( 0.964706, 0.839216, 0.741176, 1 ) 78 | Button/colors/font_color_pressed = Color( 0.0588235, 0.164706, 0.247059, 1 ) 79 | Button/constants/hseparation = 2 80 | Button/fonts/font = null 81 | Button/styles/disabled = null 82 | Button/styles/focus = null 83 | Button/styles/hover = SubResource( 1 ) 84 | Button/styles/normal = SubResource( 2 ) 85 | Button/styles/pressed = SubResource( 3 ) 86 | CheckBox/colors/font_color = Color( 0.0588235, 0.164706, 0.247059, 1 ) 87 | CheckBox/colors/font_color_disabled = Color( 0.901961, 0.901961, 0.901961, 0.2 ) 88 | CheckBox/colors/font_color_hover = Color( 0.964706, 0.839216, 0.741176, 1 ) 89 | CheckBox/colors/font_color_hover_pressed = Color( 0.964706, 0.839216, 0.741176, 1 ) 90 | CheckBox/colors/font_color_pressed = Color( 0.0588235, 0.164706, 0.247059, 1 ) 91 | CheckBox/constants/check_vadjust = 0 92 | CheckBox/constants/hseparation = 4 93 | CheckBox/fonts/font = null 94 | CheckBox/icons/checked = null 95 | CheckBox/icons/radio_checked = null 96 | CheckBox/icons/radio_unchecked = null 97 | CheckBox/icons/unchecked = null 98 | CheckBox/styles/disabled = null 99 | CheckBox/styles/focus = null 100 | CheckBox/styles/hover = SubResource( 4 ) 101 | CheckBox/styles/hover_pressed = SubResource( 4 ) 102 | CheckBox/styles/normal = SubResource( 5 ) 103 | CheckBox/styles/pressed = SubResource( 5 ) 104 | CheckButton/colors/font_color = Color( 0.88, 0.88, 0.88, 1 ) 105 | CheckButton/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) 106 | CheckButton/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 ) 107 | CheckButton/colors/font_color_hover_pressed = Color( 1, 1, 1, 1 ) 108 | CheckButton/colors/font_color_pressed = Color( 1, 1, 1, 1 ) 109 | CheckButton/constants/check_vadjust = 0 110 | CheckButton/constants/hseparation = 4 111 | CheckButton/fonts/font = null 112 | CheckButton/icons/off = null 113 | CheckButton/icons/off_disabled = null 114 | CheckButton/icons/on = null 115 | CheckButton/icons/on_disabled = null 116 | CheckButton/styles/disabled = null 117 | CheckButton/styles/focus = null 118 | CheckButton/styles/hover = null 119 | CheckButton/styles/hover_pressed = null 120 | CheckButton/styles/normal = null 121 | CheckButton/styles/pressed = null 122 | ColorPicker/constants/h_width = 30 123 | ColorPicker/constants/label_width = 10 124 | ColorPicker/constants/margin = 4 125 | ColorPicker/constants/sv_height = 256 126 | ColorPicker/constants/sv_width = 256 127 | ColorPicker/icons/add_preset = null 128 | ColorPicker/icons/color_hue = null 129 | ColorPicker/icons/color_sample = null 130 | ColorPicker/icons/overbright_indicator = null 131 | ColorPicker/icons/preset_bg = null 132 | ColorPicker/icons/screen_picker = null 133 | ColorPickerButton/colors/font_color = Color( 1, 1, 1, 1 ) 134 | ColorPickerButton/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.3 ) 135 | ColorPickerButton/colors/font_color_hover = Color( 1, 1, 1, 1 ) 136 | ColorPickerButton/colors/font_color_pressed = Color( 0.8, 0.8, 0.8, 1 ) 137 | ColorPickerButton/constants/hseparation = 2 138 | ColorPickerButton/fonts/font = SubResource( 6 ) 139 | ColorPickerButton/icons/bg = null 140 | ColorPickerButton/styles/disabled = null 141 | ColorPickerButton/styles/focus = null 142 | ColorPickerButton/styles/hover = SubResource( 7 ) 143 | ColorPickerButton/styles/normal = SubResource( 8 ) 144 | ColorPickerButton/styles/pressed = SubResource( 8 ) 145 | HSlider/icons/grabber = ExtResource( 3 ) 146 | HSlider/icons/grabber_disabled = null 147 | HSlider/icons/grabber_highlight = ExtResource( 2 ) 148 | HSlider/icons/tick = null 149 | HSlider/styles/grabber_area = SubResource( 9 ) 150 | HSlider/styles/grabber_area_highlight = SubResource( 10 ) 151 | HSlider/styles/slider = SubResource( 11 ) 152 | Label/colors/font_color = Color( 0.964706, 0.839216, 0.741176, 1 ) 153 | Label/colors/font_color_shadow = Color( 0, 0, 0, 0 ) 154 | Label/colors/font_outline_modulate = Color( 1, 1, 1, 1 ) 155 | Label/constants/line_spacing = 3 156 | Label/constants/shadow_as_outline = 0 157 | Label/constants/shadow_offset_x = 1 158 | Label/constants/shadow_offset_y = 1 159 | Label/fonts/font = null 160 | Label/styles/normal = SubResource( 12 ) 161 | LineEdit/colors/clear_button_color = Color( 0.88, 0.88, 0.88, 1 ) 162 | LineEdit/colors/clear_button_color_pressed = Color( 1, 1, 1, 1 ) 163 | LineEdit/colors/cursor_color = Color( 0.94, 0.94, 0.94, 1 ) 164 | LineEdit/colors/font_color = Color( 0.964706, 0.839216, 0.741176, 1 ) 165 | LineEdit/colors/font_color_selected = Color( 0.0588235, 0.164706, 0.247059, 1 ) 166 | LineEdit/colors/font_color_uneditable = Color( 0.88, 0.88, 0.88, 0.5 ) 167 | LineEdit/colors/selection_color = Color( 0.49, 0.49, 0.49, 1 ) 168 | LineEdit/constants/minimum_spaces = 12 169 | LineEdit/fonts/font = null 170 | LineEdit/icons/clear = null 171 | LineEdit/styles/focus = SubResource( 13 ) 172 | LineEdit/styles/normal = SubResource( 14 ) 173 | LineEdit/styles/read_only = null 174 | OptionButton/colors/font_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 175 | OptionButton/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) 176 | OptionButton/colors/font_color_hover = Color( 0, 0, 0, 1 ) 177 | OptionButton/colors/font_color_pressed = Color( 0.811765, 0.811765, 0.811765, 1 ) 178 | OptionButton/constants/arrow_margin = 2 179 | OptionButton/constants/hseparation = 2 180 | OptionButton/fonts/font = null 181 | OptionButton/icons/arrow = null 182 | OptionButton/styles/disabled = null 183 | OptionButton/styles/focus = null 184 | OptionButton/styles/hover = null 185 | OptionButton/styles/normal = null 186 | OptionButton/styles/pressed = null 187 | PopupMenu/colors/font_color = Color( 0.811765, 0.811765, 0.811765, 1 ) 188 | PopupMenu/colors/font_color_accel = Color( 0.7, 0.7, 0.7, 0.8 ) 189 | PopupMenu/colors/font_color_disabled = Color( 0.4, 0.4, 0.4, 0.8 ) 190 | PopupMenu/colors/font_color_hover = Color( 0, 0, 0, 1 ) 191 | PopupMenu/constants/hseparation = 4 192 | PopupMenu/constants/vseparation = 4 193 | PopupMenu/fonts/font = null 194 | PopupMenu/icons/checked = null 195 | PopupMenu/icons/radio_checked = null 196 | PopupMenu/icons/radio_unchecked = null 197 | PopupMenu/icons/submenu = null 198 | PopupMenu/icons/unchecked = null 199 | PopupMenu/styles/hover = SubResource( 15 ) 200 | PopupMenu/styles/labeled_separator_left = null 201 | PopupMenu/styles/labeled_separator_right = null 202 | PopupMenu/styles/panel = SubResource( 16 ) 203 | PopupMenu/styles/panel_disabled = null 204 | PopupMenu/styles/separator = null 205 | SpinBox/icons/updown = ExtResource( 1 ) 206 | -------------------------------------------------------------------------------- /GUI/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/GUI/empty.png -------------------------------------------------------------------------------- /GUI/empty.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/empty.png-7cb7d93001c156d1386852c305e73520.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://GUI/empty.png" 13 | dest_files=[ "res://.import/empty.png-7cb7d93001c156d1386852c305e73520.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /GUI/grabber-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/GUI/grabber-highlight.png -------------------------------------------------------------------------------- /GUI/grabber-highlight.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/grabber-highlight.png-1636904f3bbae30f4c12eb622baaa829.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://GUI/grabber-highlight.png" 13 | dest_files=[ "res://.import/grabber-highlight.png-1636904f3bbae30f4c12eb622baaa829.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /GUI/grabber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/GUI/grabber.png -------------------------------------------------------------------------------- /GUI/grabber.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/grabber.png-ecd4c574c7515e2c5e0171cca1c6331e.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://GUI/grabber.png" 13 | dest_files=[ "res://.import/grabber.png-ecd4c574c7515e2c5e0171cca1c6331e.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /GUI/slkscre.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/GUI/slkscre.ttf -------------------------------------------------------------------------------- /GUI/transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/GUI/transparent.png -------------------------------------------------------------------------------- /GUI/transparent.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/transparent.png-0364789b28d79203d8fc6824636f8e2a.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://GUI/transparent.png" 13 | dest_files=[ "res://.import/transparent.png-0364789b28d79203d8fc6824636f8e2a.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=1 23 | flags/filter=false 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Deep-Fold 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PixelSpace 2 | 3 | Code available under MIT license, but do not distribute or sell any generated images on their own. 4 | Feel free to use them in your games or other projects however. 5 | -------------------------------------------------------------------------------- /addons/HTML5FileExchange/HTML5FileExchange.gd: -------------------------------------------------------------------------------- 1 | extends Node 2 | 3 | signal InFocus 4 | 5 | func _ready(): 6 | if OS.get_name() == "HTML5" and OS.has_feature('JavaScript'): 7 | _define_js() 8 | 9 | 10 | func _notification(notification:int) -> void: 11 | if notification == MainLoop.NOTIFICATION_WM_FOCUS_IN: 12 | emit_signal("InFocus") 13 | 14 | func _define_js()->void: 15 | #Define JS script 16 | JavaScript.eval(""" 17 | var fileData; 18 | var fileType; 19 | var fileName; 20 | var canceled; 21 | function upload() { 22 | canceled = true; 23 | var input = document.createElement('INPUT'); 24 | input.setAttribute("type", "file"); 25 | input.setAttribute("accept", "image/png, image/jpeg, image/webp"); 26 | input.click(); 27 | input.addEventListener('change', event => { 28 | if (event.target.files.length > 0){ 29 | canceled = false;} 30 | var file = event.target.files[0]; 31 | var reader = new FileReader(); 32 | fileType = file.type; 33 | fileName = file.name; 34 | reader.readAsArrayBuffer(file); 35 | reader.onloadend = function (evt) { 36 | if (evt.target.readyState == FileReader.DONE) { 37 | fileData = evt.target.result; 38 | } 39 | } 40 | }); 41 | } 42 | function download(fileName, byte) { 43 | var buffer = Uint8Array.from(byte); 44 | var blob = new Blob([buffer], { type: 'image/png'}); 45 | var link = document.createElement('a'); 46 | link.href = window.URL.createObjectURL(blob); 47 | link.download = fileName; 48 | link.click(); 49 | }; 50 | """, true) 51 | 52 | 53 | func load_image()->Image: 54 | if OS.get_name() != "HTML5" or !OS.has_feature('JavaScript'): 55 | return 56 | 57 | #Execute js function 58 | JavaScript.eval("upload();", true) #opens promt for choosing file 59 | 60 | #label.text = "Wait for focus" 61 | yield(self, "InFocus") #wait until js promt is closed 62 | 63 | #label.text = "Timer on for loading" 64 | yield(get_tree().create_timer(0.1), "timeout") #give some time for async js data load 65 | 66 | if JavaScript.eval("canceled;", true): # if File Dialog closed w/o file 67 | #label.text = "Canceled prompt" 68 | return 69 | 70 | # use data from png data 71 | #label.text = "Load image" 72 | var imageData 73 | while true: 74 | imageData = JavaScript.eval("fileData;", true) 75 | if imageData != null: 76 | break 77 | #label.text = "No image yet" 78 | yield(get_tree().create_timer(1.0), "timeout") #need more time to load data 79 | 80 | var imageType = JavaScript.eval("fileType;", true) 81 | var imageName = JavaScript.eval("fileName;", true) 82 | 83 | var image = Image.new() 84 | var image_error 85 | match imageType: 86 | "image/png": 87 | image_error = image.load_png_from_buffer(imageData) 88 | "image/jpeg": 89 | image_error = image.load_jpg_from_buffer(imageData) 90 | "image/webp": 91 | image_error = image.load_webp_from_buffer(imageData) 92 | var invalidType: 93 | #label.text = "Unsupported file format - %s." % invalidType 94 | return 95 | if image_error: 96 | #label.text = "An error occurred while trying to display the image." 97 | return 98 | else: 99 | return image 100 | # Display texture 101 | var tex = ImageTexture.new() 102 | tex.create_from_image(image, 0) # Flag = 0 or else export is fucked! 103 | Sprite.texture = tex 104 | #loadedImage = image # Keep Image for later, just in case... 105 | #loadedImageName = imageName 106 | #label.text = "Image %s loaded as %s." % [imageName, imageType] 107 | return 108 | #label.text = "Something went wrong" 109 | 110 | 111 | func save_image(image:Image, fileName:String = "export")->void: 112 | if OS.get_name() != "HTML5" or !OS.has_feature('JavaScript'): 113 | return 114 | 115 | image.clear_mipmaps() 116 | if image.save_png("user://export_temp.png"): 117 | #label.text = "Error saving temp file" 118 | return 119 | var file:File = File.new() 120 | if file.open("user://export_temp.png", File.READ): 121 | #label.text = "Error opening file" 122 | return 123 | var pngData = Array(file.get_buffer(file.get_len())) #read data as PoolByteArray and convert it to Array for JS 124 | file.close() 125 | var dir = Directory.new() 126 | dir.remove("user://export_temp.png") 127 | JavaScript.eval("download('%s', %s);" % [fileName, str(pngData)], true) 128 | #label.text = "Saving DONE" 129 | -------------------------------------------------------------------------------- /addons/HTML5FileExchange/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="HTML5 File Exchange" 4 | description="Open/Import and Save/Export files in HTML5 environment. 5 | Supported input - *.png, *.jpeg, *.webp 6 | Supported output - *.png 7 | 8 | Usage: 9 | Get file from User - 10 | var image:Image = yield(HTML5File.get_image(), \"completed\") 11 | Send file to User - 12 | HTML5File.save_image(image:Image, fileName:String = \"export\")" 13 | author="laame" 14 | version="0.1.1" 15 | script="plugin.gd" 16 | -------------------------------------------------------------------------------- /addons/HTML5FileExchange/plugin.gd: -------------------------------------------------------------------------------- 1 | tool 2 | extends EditorPlugin 3 | 4 | 5 | func _enter_tree(): 6 | add_autoload_singleton("HTML5File", "res://addons/HTML5FileExchange/HTML5FileExchange.gd") 7 | 8 | 9 | func _exit_tree(): 10 | remove_autoload_singleton("HTML5File") 11 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=2] 2 | 3 | [sub_resource type="ProceduralSky" id=1] 4 | 5 | [resource] 6 | background_mode = 2 7 | background_sky = SubResource( 1 ) 8 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Deep-Fold/PixelSpace/758359fe695972d84b8223bfad5436bdff1d5844/icon.png -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://icon.png" 13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=4 10 | 11 | _global_script_classes=[ ] 12 | _global_script_class_icons={ 13 | } 14 | 15 | [application] 16 | 17 | config/name="SpaceBackground" 18 | run/main_scene="res://GUI/GUI.tscn" 19 | config/icon="res://icon.png" 20 | 21 | [autoload] 22 | 23 | HTML5File="*res://addons/HTML5FileExchange/HTML5FileExchange.gd" 24 | 25 | [display] 26 | 27 | window/size/width=1062 28 | window/stretch/mode="viewport" 29 | window/stretch/aspect="keep" 30 | 31 | [editor_plugins] 32 | 33 | enabled=PoolStringArray( "HTML5FileExchange" ) 34 | 35 | [rendering] 36 | 37 | 2d/snapping/use_gpu_pixel_snap=true 38 | environment/default_environment="res://default_env.tres" 39 | quality/dynamic_fonts/use_oversampling=false 40 | quality/2d/use_pixel_snap=true 41 | --------------------------------------------------------------------------------