forked from RodZill4/material-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.tscn
317 lines (281 loc) · 10.8 KB
/
start.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
[gd_scene load_steps=48 format=2]
[ext_resource path="res://start.gd" type="Script" id=1]
[ext_resource path="res://material_maker/fonts/vegur_regular.otf" type="DynamicFontData" id=2]
[ext_resource path="res://material_maker/icons/godot_logo.svg" type="Texture" id=3]
[ext_resource path="res://icon.png" type="Texture" id=4]
[ext_resource path="res://material_maker/loading_screen/tile01.png" type="Texture" id=5]
[ext_resource path="res://material_maker/loading_screen/tile04.png" type="Texture" id=6]
[ext_resource path="res://material_maker/loading_screen/tile03.png" type="Texture" id=7]
[ext_resource path="res://material_maker/loading_screen/tile02.png" type="Texture" id=8]
[ext_resource path="res://material_maker/loading_screen/tile06.png" type="Texture" id=9]
[ext_resource path="res://material_maker/loading_screen/tile05.png" type="Texture" id=10]
[ext_resource path="res://material_maker/loading_screen/tile07.png" type="Texture" id=11]
[ext_resource path="res://material_maker/loading_screen/tile08.png" type="Texture" id=12]
[ext_resource path="res://material_maker/loading_screen/tile12.png" type="Texture" id=13]
[ext_resource path="res://material_maker/loading_screen/tile14.png" type="Texture" id=14]
[ext_resource path="res://material_maker/loading_screen/tile15.png" type="Texture" id=15]
[ext_resource path="res://material_maker/loading_screen/tile11.png" type="Texture" id=16]
[ext_resource path="res://material_maker/loading_screen/tile10.png" type="Texture" id=17]
[ext_resource path="res://material_maker/loading_screen/tile09.png" type="Texture" id=18]
[ext_resource path="res://material_maker/loading_screen/tile13.png" type="Texture" id=19]
[ext_resource path="res://material_maker/loading_screen/tile16.png" type="Texture" id=20]
[ext_resource path="res://material_maker/loading_screen/tile19.png" type="Texture" id=21]
[ext_resource path="res://material_maker/loading_screen/tile18.png" type="Texture" id=22]
[ext_resource path="res://material_maker/loading_screen/tile20.png" type="Texture" id=23]
[ext_resource path="res://material_maker/loading_screen/tile17.png" type="Texture" id=24]
[ext_resource path="res://material_maker/loading_screen/tile24.png" type="Texture" id=25]
[ext_resource path="res://material_maker/loading_screen/tile22.png" type="Texture" id=26]
[ext_resource path="res://material_maker/loading_screen/tile21.png" type="Texture" id=27]
[ext_resource path="res://material_maker/loading_screen/tile23.png" type="Texture" id=28]
[ext_resource path="res://material_maker/loading_screen/tile28.png" type="Texture" id=29]
[ext_resource path="res://material_maker/loading_screen/tile29.png" type="Texture" id=30]
[ext_resource path="res://material_maker/loading_screen/tile33.png" type="Texture" id=31]
[ext_resource path="res://material_maker/loading_screen/tile34.png" type="Texture" id=32]
[ext_resource path="res://material_maker/loading_screen/tile35.png" type="Texture" id=33]
[ext_resource path="res://material_maker/loading_screen/tile36.png" type="Texture" id=34]
[ext_resource path="res://material_maker/loading_screen/tile30.png" type="Texture" id=35]
[ext_resource path="res://material_maker/loading_screen/tile31.png" type="Texture" id=36]
[ext_resource path="res://material_maker/loading_screen/tile27.png" type="Texture" id=37]
[ext_resource path="res://material_maker/loading_screen/tile32.png" type="Texture" id=38]
[ext_resource path="res://material_maker/loading_screen/tile25.png" type="Texture" id=39]
[ext_resource path="res://material_maker/loading_screen/tile26.png" type="Texture" id=40]
[sub_resource type="GDScript" id=7]
script/source = "tool
extends Control
export var textures : Array = []
export var count_x : int = 5 setget set_count_x
export var count_y : int = 5 setget set_count_y
export var step_x : int = 5 setget set_step_x
export var step_y : int = 5 setget set_step_y
export var empty_space : int = 5 setget set_empty_space
func set_count_x(v : int):
count_x = v
rebuild()
func set_count_y(v : int):
count_y = v
rebuild()
func set_step_x(v : int):
step_x = v
rebuild()
func set_step_y(v : int):
step_y = v
rebuild()
func set_empty_space(v : int):
empty_space = v
rebuild()
static func permutations(a : Array, s : int = -1):
var size : int = a.size()
if s < 0:
s = size-1
for i in s:
var pi : int = i+(randi() % (size - i))
if pi != i:
var tmp = a[pi]
a[pi] = a[i]
a[i] = tmp
return a
func rebuild():
if !is_inside_tree():
return
for c in get_children():
if c != $Tile:
remove_child(c)
c.free()
var texture_count = textures.size()
seed(OS.get_ticks_usec())
var reorder : Array = permutations(range(texture_count))
var texture_index = 0
$Tile.texture = textures[reorder[texture_index]]
for x in count_x:
for y in count_y:
if x == 0 and y == 0:
continue
var pos = $Tile.rect_position+Vector2(x*step_x, y*step_y+(x&1)*(step_y>>1))
var center = pos+0.5*$Tile.rect_size
if abs(center.x-0.5*rect_size.x) < empty_space:
continue
texture_index += 1
if texture_index >= textures.size():
texture_index = 0
var t : TextureRect = $Tile.duplicate()
t.texture = textures[reorder[texture_index]]
t.rect_position += Vector2(x*step_x, y*step_y+(x&1)*(step_y>>1))
add_child(t)
if get_child_count() > texture_count:
print(\"WARNING: More textures are needed for the loading screen\")
func _on_Background_resized():
rebuild()
"
[sub_resource type="Shader" id=8]
code = "shader_type canvas_item;
render_mode blend_mix;
void fragment() {
const vec3 k = vec3(-0.866025404, 0.5, 0.577350269);
float r = 0.4;
vec2 p = abs(UV-0.5)*vec2(1.0, 0.866025404);
p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
float hex = clamp(1.0-50.0*length(p)*sign(p.y), 0.0, 1.0);
COLOR = vec4(texture(TEXTURE, UV).rgb, hex);
}
"
[sub_resource type="ShaderMaterial" id=9]
shader = SubResource( 8 )
[sub_resource type="DynamicFont" id=3]
size = 72
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxFlat" id=4]
bg_color = Color( 1, 1, 1, 1 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.380392, 0.388235, 0.486275, 1 )
[sub_resource type="StyleBoxFlat" id=5]
bg_color = Color( 0.380392, 0.388235, 0.486275, 1 )
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color( 0.380392, 0.388235, 0.486275, 1 )
[sub_resource type="StyleBoxFlat" id=6]
bg_color = Color( 0.0235294, 0.0313726, 0.12549, 0.929412 )
border_width_left = 3
border_width_top = 3
border_width_right = 3
border_width_bottom = 3
border_color = Color( 1, 0, 0, 1 )
[node name="Start" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="Background" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( -23, 13 )
script = SubResource( 7 )
textures = [ ExtResource( 5 ), ExtResource( 8 ), ExtResource( 7 ), ExtResource( 6 ), ExtResource( 10 ), ExtResource( 9 ), ExtResource( 11 ), ExtResource( 12 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 16 ), ExtResource( 13 ), ExtResource( 19 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 20 ), ExtResource( 24 ), ExtResource( 22 ), ExtResource( 21 ), ExtResource( 23 ), ExtResource( 27 ), ExtResource( 26 ), ExtResource( 28 ), ExtResource( 25 ), ExtResource( 39 ), ExtResource( 40 ), ExtResource( 37 ), ExtResource( 29 ), ExtResource( 30 ), ExtResource( 35 ), ExtResource( 36 ), ExtResource( 38 ), ExtResource( 31 ), ExtResource( 32 ), ExtResource( 33 ), ExtResource( 34 ) ]
count_x = 11
count_y = 6
step_x = 122
step_y = 142
empty_space = 300
[node name="Tile" type="TextureRect" parent="Background"]
material = SubResource( 9 )
margin_left = -156.0
margin_top = -252.0
margin_right = 164.0
margin_bottom = 26.0
rect_scale = Vector2( 0.5, 0.5 )
rect_pivot_offset = Vector2( 212, 330 )
texture = ExtResource( 7 )
stretch_mode = 1
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -275.0
margin_right = 275.0
alignment = 1
[node name="Space1" type="Control" parent="VBoxContainer"]
margin_bottom = 40.0
rect_min_size = Vector2( 0, 40 )
size_flags_horizontal = 0
size_flags_stretch_ratio = 2.0
[node name="Icon" type="TextureRect" parent="VBoxContainer"]
margin_left = 147.0
margin_top = 44.0
margin_right = 403.0
margin_bottom = 300.0
size_flags_horizontal = 4
texture = ExtResource( 4 )
stretch_mode = 1
[node name="Space2" type="Control" parent="VBoxContainer"]
margin_top = 304.0
margin_bottom = 344.0
rect_min_size = Vector2( 0, 40 )
size_flags_horizontal = 0
size_flags_stretch_ratio = 2.0
[node name="Title" type="Label" parent="VBoxContainer"]
margin_top = 348.0
margin_right = 550.0
margin_bottom = 435.0
custom_fonts/font = SubResource( 3 )
text = "Material Maker"
align = 1
[node name="Label" type="Label" parent="VBoxContainer"]
margin_top = 439.0
margin_right = 550.0
margin_bottom = 453.0
align = 1
[node name="ProgressBar" type="ProgressBar" parent="VBoxContainer"]
margin_left = 150.0
margin_top = 457.0
margin_right = 400.0
margin_bottom = 473.0
rect_min_size = Vector2( 250, 16 )
size_flags_horizontal = 4
custom_styles/fg = SubResource( 4 )
custom_styles/bg = SubResource( 5 )
percent_visible = false
[node name="Space3" type="Control" parent="VBoxContainer"]
margin_top = 477.0
margin_bottom = 524.0
size_flags_horizontal = 0
size_flags_vertical = 3
size_flags_stretch_ratio = 0.75
[node name="Label2" type="Label" parent="VBoxContainer"]
margin_top = 528.0
margin_right = 550.0
margin_bottom = 542.0
text = "Powered by"
align = 1
[node name="TextureRect" type="TextureRect" parent="VBoxContainer"]
margin_left = 181.0
margin_top = 546.0
margin_right = 368.0
margin_bottom = 615.0
size_flags_horizontal = 4
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Space4" type="Control" parent="VBoxContainer"]
margin_top = 619.0
margin_bottom = 666.0
size_flags_horizontal = 0
size_flags_vertical = 3
size_flags_stretch_ratio = 0.75
[node name="Patreon" type="Label" parent="VBoxContainer"]
margin_top = 670.0
margin_right = 550.0
margin_bottom = 720.0
rect_min_size = Vector2( 550, 50 )
mouse_filter = 0
size_flags_horizontal = 5
align = 1
valign = 2
autowrap = true
[node name="ErrorPanel" type="Panel" parent="."]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -268.5
margin_top = -76.0
margin_right = 268.5
margin_bottom = 76.0
rect_pivot_offset = Vector2( 267.976, 75.7381 )
custom_styles/panel = SubResource( 6 )
[node name="Label" type="Label" parent="ErrorPanel"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
align = 1
valign = 1
[connection signal="resized" from="Background" to="Background" method="_on_Background_resized"]
[connection signal="gui_input" from="VBoxContainer/Patreon" to="." method="_on_Patreon_gui_input"]