cyberarm_engine 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/shaders/fragment/g_buffer.glsl +30 -0
- data/assets/shaders/fragment/lighting.glsl +63 -0
- data/assets/shaders/include/light_struct.glsl +11 -0
- data/assets/shaders/vertex/g_buffer.glsl +28 -0
- data/assets/shaders/vertex/lighting.glsl +17 -0
- data/lib/cyberarm_engine/background_image.rb +1 -1
- data/lib/cyberarm_engine/builtin/intro_state.rb +2 -2
- data/lib/cyberarm_engine/common.rb +12 -0
- data/lib/cyberarm_engine/game_state.rb +4 -0
- data/lib/cyberarm_engine/opengl/renderer/g_buffer.rb +1 -0
- data/lib/cyberarm_engine/opengl.rb +13 -1
- data/lib/cyberarm_engine/ui/border_canvas.rb +2 -2
- data/lib/cyberarm_engine/ui/element.rb +35 -18
- data/lib/cyberarm_engine/ui/elements/container.rb +12 -1
- data/lib/cyberarm_engine/ui/elements/edit_line.rb +6 -0
- data/lib/cyberarm_engine/ui/elements/image.rb +2 -2
- data/lib/cyberarm_engine/ui/elements/progress.rb +5 -0
- data/lib/cyberarm_engine/ui/elements/slider.rb +2 -0
- data/lib/cyberarm_engine/ui/elements/text_block.rb +8 -0
- data/lib/cyberarm_engine/ui/gui_state.rb +25 -9
- data/lib/cyberarm_engine/version.rb +1 -1
- data/lib/cyberarm_engine/window.rb +5 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c883f949982d339928785f9dbcbe710a7df483ba698ce6e3e95d38d300cf4e03
|
4
|
+
data.tar.gz: 17364dddce1f68533a01b9b69d591792bf4c9495341fc3a9726d77e70fa8246f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd9fdd1da003de3a01e1d56ba1cedff869ef702ed0f070725f8a234f5a4686bd7798bc1239a0f346d0191fd2709e2c91816a461a20bb7c862fdff940ca3968c6
|
7
|
+
data.tar.gz: 7d6afa770c285bd0c841607eda82d1bc36f1b70b15f5c6864db837822855f54243d5a44c64395ae6bf161c74d424ac9a529b5241161c520f481844df06ef1b5d
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# version 330 core
|
2
|
+
|
3
|
+
layout(location = 0) out vec3 fragPosition;
|
4
|
+
layout (location = 1) out vec4 fragColor;
|
5
|
+
layout (location = 2) out vec3 fragNormal;
|
6
|
+
layout (location = 3) out vec3 fragUV;
|
7
|
+
|
8
|
+
in vec3 outPosition, outColor, outNormal, outUV, outFragPos, outCameraPos;
|
9
|
+
out vec4 outputFragColor;
|
10
|
+
flat in int outHasTexture;
|
11
|
+
|
12
|
+
uniform sampler2D diffuse_texture;
|
13
|
+
|
14
|
+
void main() {
|
15
|
+
vec3 result;
|
16
|
+
|
17
|
+
if (outHasTexture == 0) {
|
18
|
+
result = outColor;
|
19
|
+
} else {
|
20
|
+
result = texture(diffuse_texture, outUV.xy).xyz + 0.25;
|
21
|
+
}
|
22
|
+
|
23
|
+
fragPosition = outPosition;
|
24
|
+
fragColor = vec4(result, 1.0);
|
25
|
+
fragNormal = outNormal;
|
26
|
+
fragUV = outUV;
|
27
|
+
|
28
|
+
float gamma = 2.2;
|
29
|
+
outputFragColor.rgb = pow(fragColor.rgb, vec3(1.0 / gamma));
|
30
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#version 330 core
|
2
|
+
out vec4 FragColor;
|
3
|
+
|
4
|
+
@include "light_struct"
|
5
|
+
const int DIRECTIONAL = 0;
|
6
|
+
const int POINT = 1;
|
7
|
+
const int SPOT = 2;
|
8
|
+
|
9
|
+
in vec2 outTexCoords;
|
10
|
+
flat in Light outLight[1];
|
11
|
+
|
12
|
+
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
13
|
+
|
14
|
+
vec4 directionalLight(Light light) {
|
15
|
+
vec3 norm = normalize(texture(normal, outTexCoords).rgb);
|
16
|
+
vec3 diffuse_color = texture(diffuse, outTexCoords).rgb;
|
17
|
+
vec3 fragPos = texture(position, outTexCoords).rgb;
|
18
|
+
|
19
|
+
vec3 lightDir = normalize(light.position - fragPos);
|
20
|
+
float diff = max(dot(norm, lightDir), 0);
|
21
|
+
|
22
|
+
vec3 _ambient = light.ambient;
|
23
|
+
vec3 _diffuse = light.diffuse * diff;
|
24
|
+
vec3 _specular = light.specular;
|
25
|
+
|
26
|
+
return vec4(_diffuse + _ambient + _specular, 1.0);
|
27
|
+
}
|
28
|
+
|
29
|
+
vec4 pointLight(Light light) {
|
30
|
+
return vec4(0.25, 0.25, 0.25, 1);
|
31
|
+
}
|
32
|
+
|
33
|
+
vec4 spotLight(Light light) {
|
34
|
+
return vec4(0.5, 0.5, 0.5, 1);
|
35
|
+
}
|
36
|
+
|
37
|
+
vec4 calculateLighting(Light light) {
|
38
|
+
vec4 result;
|
39
|
+
|
40
|
+
// switch(light.type) {
|
41
|
+
// case DIRECTIONAL: {
|
42
|
+
// result = directionalLight(light);
|
43
|
+
// }
|
44
|
+
// case SPOT: {
|
45
|
+
// result = spotLight(light);
|
46
|
+
// }
|
47
|
+
// default: {
|
48
|
+
// result = pointLight(light);
|
49
|
+
// }
|
50
|
+
// }
|
51
|
+
|
52
|
+
if (light.type == DIRECTIONAL) {
|
53
|
+
result = directionalLight(light);
|
54
|
+
} else {
|
55
|
+
result = pointLight(light);
|
56
|
+
}
|
57
|
+
|
58
|
+
return result;
|
59
|
+
}
|
60
|
+
|
61
|
+
void main() {
|
62
|
+
FragColor = texture(diffuse, outTexCoords) * calculateLighting(outLight[0]);
|
63
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# version 330 core
|
2
|
+
|
3
|
+
layout(location = 0) in vec3 inPosition;
|
4
|
+
layout(location = 1) in vec3 inColor;
|
5
|
+
layout(location = 2) in vec3 inNormal;
|
6
|
+
layout(location = 3) in vec3 inUV;
|
7
|
+
|
8
|
+
uniform mat4 projection, view, model;
|
9
|
+
uniform int hasTexture;
|
10
|
+
uniform vec3 cameraPos;
|
11
|
+
|
12
|
+
out vec3 outPosition, outColor, outNormal, outUV;
|
13
|
+
out vec3 outFragPos, outViewPos, outCameraPos;
|
14
|
+
flat out int outHasTexture;
|
15
|
+
|
16
|
+
void main() {
|
17
|
+
// projection * view * model * position
|
18
|
+
outPosition = inPosition;
|
19
|
+
outColor = inColor;
|
20
|
+
outNormal= normalize(transpose(inverse(mat3(model))) * inNormal);
|
21
|
+
outUV = inUV;
|
22
|
+
outHasTexture = hasTexture;
|
23
|
+
outCameraPos = cameraPos;
|
24
|
+
|
25
|
+
outFragPos = vec3(model * vec4(inPosition, 1.0));
|
26
|
+
|
27
|
+
gl_Position = projection * view * model * vec4(inPosition, 1.0);
|
28
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#version 330 core
|
2
|
+
@include "light_struct"
|
3
|
+
|
4
|
+
layout (location = 0) in vec3 inPosition;
|
5
|
+
layout (location = 1) in vec2 inTexCoords;
|
6
|
+
|
7
|
+
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
8
|
+
uniform Light light[1];
|
9
|
+
|
10
|
+
out vec2 outTexCoords;
|
11
|
+
flat out Light outLight[1];
|
12
|
+
|
13
|
+
void main() {
|
14
|
+
gl_Position = vec4(inPosition.x, inPosition.y, inPosition.z, 1.0);
|
15
|
+
outTexCoords = inTexCoords;
|
16
|
+
outLight = light;
|
17
|
+
}
|
@@ -7,8 +7,8 @@ module CyberarmEngine
|
|
7
7
|
@title_size = 56
|
8
8
|
@caption_size = 24
|
9
9
|
|
10
|
-
@title = CyberarmEngine::Text.new("", size: @title_size, shadow_color: 0xaa_222222)
|
11
|
-
@caption = CyberarmEngine::Text.new("", size: @caption_size, shadow_color: 0xaa_222222)
|
10
|
+
@title = CyberarmEngine::Text.new("", size: @title_size, shadow_color: 0xaa_222222, static: true)
|
11
|
+
@caption = CyberarmEngine::Text.new("", size: @caption_size, shadow_color: 0xaa_222222, static: true)
|
12
12
|
|
13
13
|
@spacer_width = 256
|
14
14
|
@spacer_height = 6
|
@@ -31,6 +31,18 @@ module CyberarmEngine
|
|
31
31
|
window.show_cursor = boolean
|
32
32
|
end
|
33
33
|
|
34
|
+
def find_element_by_tag(container, tag, list = [])
|
35
|
+
return unless container
|
36
|
+
|
37
|
+
container.children.each do |child|
|
38
|
+
list << child if child.style.tag == tag
|
39
|
+
|
40
|
+
find_element_by_tag(child, tag, list) if child.is_a?(CyberarmEngine::Element::Container)
|
41
|
+
end
|
42
|
+
|
43
|
+
list.first
|
44
|
+
end
|
45
|
+
|
34
46
|
def draw_rect(x, y, width, height, color, z = 0, mode = :default)
|
35
47
|
Gosu.draw_rect(x, y, width, height, color, z, mode)
|
36
48
|
end
|
@@ -11,7 +11,19 @@ module CyberarmEngine
|
|
11
11
|
if e != GL_NO_ERROR
|
12
12
|
warn "OpenGL error detected by handler at: #{caller[0]}"
|
13
13
|
warn " #{gluErrorString(e)} (#{e})\n"
|
14
|
-
exit if
|
14
|
+
exit if Window.instance&.exit_on_opengl_error?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def preload_default_shaders
|
19
|
+
shaders = %w[g_buffer lighting]
|
20
|
+
shaders.each do |shader|
|
21
|
+
Shader.new(
|
22
|
+
name: shader,
|
23
|
+
includes_dir: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/include",
|
24
|
+
vertex: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/vertex/#{shader}.glsl",
|
25
|
+
fragment: "#{CYBERARM_ENGINE_ROOT_PATH}/assets/shaders/fragment/#{shader}.glsl"
|
26
|
+
)
|
15
27
|
end
|
16
28
|
end
|
17
29
|
end
|
@@ -62,11 +62,11 @@ module CyberarmEngine
|
|
62
62
|
|
63
63
|
def update
|
64
64
|
# TOP
|
65
|
-
@top.x = @element.x
|
65
|
+
@top.x = @element.x + @element.style.border_thickness_left
|
66
66
|
@top.y = @element.y
|
67
67
|
@top.z = @element.z
|
68
68
|
|
69
|
-
@top.width = @element.width
|
69
|
+
@top.width = @element.width - @element.style.border_thickness_left
|
70
70
|
@top.height = @element.style.border_thickness_top
|
71
71
|
|
72
72
|
# RIGHT
|
@@ -65,6 +65,8 @@ module CyberarmEngine
|
|
65
65
|
|
66
66
|
set_border_thickness
|
67
67
|
set_border_color
|
68
|
+
|
69
|
+
root.gui_state.request_repaint
|
68
70
|
end
|
69
71
|
|
70
72
|
def safe_style_fetch(*args)
|
@@ -166,10 +168,10 @@ module CyberarmEngine
|
|
166
168
|
return if self.is_a?(ToolTip)
|
167
169
|
|
168
170
|
if old_width != width || old_height != height
|
169
|
-
|
170
|
-
else
|
171
|
-
stylize
|
171
|
+
root.gui_state.request_recalculate
|
172
172
|
end
|
173
|
+
|
174
|
+
stylize
|
173
175
|
end
|
174
176
|
|
175
177
|
def default_events
|
@@ -256,6 +258,8 @@ module CyberarmEngine
|
|
256
258
|
end
|
257
259
|
|
258
260
|
def enabled=(boolean)
|
261
|
+
root.gui_state.request_repaint if @enabled != boolean
|
262
|
+
|
259
263
|
@enabled = boolean
|
260
264
|
|
261
265
|
recalculate
|
@@ -267,6 +271,10 @@ module CyberarmEngine
|
|
267
271
|
@enabled
|
268
272
|
end
|
269
273
|
|
274
|
+
def focused?
|
275
|
+
@focus
|
276
|
+
end
|
277
|
+
|
270
278
|
def visible?
|
271
279
|
@visible
|
272
280
|
end
|
@@ -278,18 +286,21 @@ module CyberarmEngine
|
|
278
286
|
def toggle
|
279
287
|
@visible = !@visible
|
280
288
|
root.gui_state.request_recalculate
|
289
|
+
root.gui_state.request_repaint
|
281
290
|
end
|
282
291
|
|
283
292
|
def show
|
284
293
|
bool = visible?
|
285
294
|
@visible = true
|
286
295
|
root.gui_state.request_recalculate unless bool
|
296
|
+
root.gui_state.request_repaint unless bool
|
287
297
|
end
|
288
298
|
|
289
299
|
def hide
|
290
300
|
bool = visible?
|
291
301
|
@visible = false
|
292
302
|
root.gui_state.request_recalculate if bool
|
303
|
+
root.gui_state.request_repaint if bool
|
293
304
|
end
|
294
305
|
|
295
306
|
def draw
|
@@ -423,9 +434,9 @@ module CyberarmEngine
|
|
423
434
|
|
424
435
|
pairs_ << a_ unless pairs_.last == a_
|
425
436
|
|
426
|
-
pairs_.sum { |pair| pair.map(&:outer_height).max } + @style.padding_bottom + @style.border_thickness_bottom
|
437
|
+
pairs_.sum { |pair| + @style.padding_top + @style.border_thickness_top + pair.map(&:outer_height).max } + @style.padding_bottom + @style.border_thickness_bottom
|
427
438
|
else
|
428
|
-
@children.sum(&:outer_height) + @style.padding_bottom + @style.border_thickness_bottom
|
439
|
+
@style.padding_top + @style.border_thickness_top + @children.sum(&:outer_height) + @style.padding_bottom + @style.border_thickness_bottom
|
429
440
|
end
|
430
441
|
end
|
431
442
|
|
@@ -440,21 +451,21 @@ module CyberarmEngine
|
|
440
451
|
def dimensional_size(size, dimension)
|
441
452
|
raise "dimension must be either :width or :height" unless %i[width height].include?(dimension)
|
442
453
|
|
443
|
-
new_size = if size.is_a?(
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
if @parent && @style.fill # Handle fill behavior
|
450
|
-
if dimension == :width && @parent.is_a?(Flow)
|
451
|
-
return space_available_width - noncontent_width
|
454
|
+
new_size = if size.is_a?(Float) && size.between?(0.0, 1.0)
|
455
|
+
(@parent.send(:"content_#{dimension}") * size).floor - send(:"noncontent_#{dimension}").floor
|
456
|
+
else
|
457
|
+
size
|
458
|
+
end
|
452
459
|
|
453
|
-
|
454
|
-
|
455
|
-
|
460
|
+
# Handle fill behavior
|
461
|
+
if @parent && @style.fill &&
|
462
|
+
(dimension == :width && @parent.is_a?(Flow) ||
|
463
|
+
dimension == :height && @parent.is_a?(Stack))
|
464
|
+
return space_available_width - noncontent_width if dimension == :width && @parent.is_a?(Flow)
|
465
|
+
return space_available_height - noncontent_height if dimension == :height && @parent.is_a?(Stack)
|
456
466
|
|
457
|
-
|
467
|
+
# Handle min_width/height and max_width/height
|
468
|
+
else
|
458
469
|
return @style.send(:"min_#{dimension}") if @style.send(:"min_#{dimension}") && new_size.to_f < @style.send(:"min_#{dimension}")
|
459
470
|
return @style.send(:"max_#{dimension}") if @style.send(:"max_#{dimension}") && new_size.to_f > @style.send(:"max_#{dimension}")
|
460
471
|
end
|
@@ -479,6 +490,8 @@ module CyberarmEngine
|
|
479
490
|
end
|
480
491
|
|
481
492
|
def background=(_background)
|
493
|
+
root.gui_state.request_repaint
|
494
|
+
|
482
495
|
@style.background_canvas.background = _background
|
483
496
|
update_background
|
484
497
|
end
|
@@ -497,6 +510,8 @@ module CyberarmEngine
|
|
497
510
|
end
|
498
511
|
|
499
512
|
def background_nine_slice=(_image_path)
|
513
|
+
root.gui_state.request_repaint
|
514
|
+
|
500
515
|
@style.background_nine_slice_canvas.image = _image_path
|
501
516
|
update_background_nine_slice
|
502
517
|
end
|
@@ -521,6 +536,8 @@ module CyberarmEngine
|
|
521
536
|
end
|
522
537
|
|
523
538
|
def background_image=(image_path)
|
539
|
+
root.gui_state.request_repaint
|
540
|
+
|
524
541
|
@style.background_image = image_path.is_a?(Gosu::Image) ? image_path : get_image(image_path)
|
525
542
|
update_background_image
|
526
543
|
end
|
@@ -42,6 +42,10 @@ module CyberarmEngine
|
|
42
42
|
root.gui_state.request_recalculate
|
43
43
|
end
|
44
44
|
|
45
|
+
def remove(element)
|
46
|
+
root.gui_state.request_recalculate if @children.delete(element)
|
47
|
+
end
|
48
|
+
|
45
49
|
def clear(&block)
|
46
50
|
@children.clear
|
47
51
|
|
@@ -122,6 +126,9 @@ module CyberarmEngine
|
|
122
126
|
|
123
127
|
layout
|
124
128
|
|
129
|
+
old_width = @width
|
130
|
+
old_height = @height
|
131
|
+
|
125
132
|
if is_root?
|
126
133
|
@width = @style.width = window.width
|
127
134
|
@height = @style.height = window.height
|
@@ -178,6 +185,8 @@ module CyberarmEngine
|
|
178
185
|
# puts "TOOK: #{Gosu.milliseconds - s}ms to recalculate #{self.class}:0x#{self.object_id.to_s(16)}"
|
179
186
|
|
180
187
|
update_background
|
188
|
+
|
189
|
+
root.gui_state.request_repaint if @width != old_width || @height != old_height
|
181
190
|
end
|
182
191
|
|
183
192
|
def layout
|
@@ -242,6 +251,7 @@ module CyberarmEngine
|
|
242
251
|
@scroll_position.y = 0 if @scroll_position.y > 0
|
243
252
|
|
244
253
|
root.gui_state.request_recalculate_for(self)
|
254
|
+
root.gui_state.request_repaint
|
245
255
|
|
246
256
|
return :handled
|
247
257
|
end
|
@@ -257,6 +267,7 @@ module CyberarmEngine
|
|
257
267
|
@scroll_position.y = -max_scroll_height if @scroll_position.y.abs > max_scroll_height
|
258
268
|
|
259
269
|
root.gui_state.request_recalculate_for(self)
|
270
|
+
root.gui_state.request_repaint
|
260
271
|
|
261
272
|
return :handled
|
262
273
|
end
|
@@ -278,7 +289,7 @@ module CyberarmEngine
|
|
278
289
|
end
|
279
290
|
|
280
291
|
def value
|
281
|
-
@children.map
|
292
|
+
@children.map(&:class).join(", ")
|
282
293
|
end
|
283
294
|
|
284
295
|
def to_s
|
@@ -80,16 +80,22 @@ module CyberarmEngine
|
|
80
80
|
@show_caret = true
|
81
81
|
@caret_last_interval = Gosu.milliseconds
|
82
82
|
|
83
|
+
root.gui_state.request_repaint
|
84
|
+
|
83
85
|
publish(:changed, value)
|
84
86
|
end
|
85
87
|
|
86
88
|
if @last_caret_position != @text_input.caret_pos
|
87
89
|
@last_caret_position = @text_input.caret_pos
|
90
|
+
root.gui_state.request_repaint
|
91
|
+
|
88
92
|
@show_caret = true
|
89
93
|
@caret_last_interval = Gosu.milliseconds
|
90
94
|
end
|
91
95
|
|
92
96
|
if Gosu.milliseconds >= @caret_last_interval + @caret_interval
|
97
|
+
root.gui_state.request_repaint
|
98
|
+
|
93
99
|
@caret_last_interval = Gosu.milliseconds
|
94
100
|
|
95
101
|
@show_caret = !@show_caret
|
@@ -45,8 +45,8 @@ module CyberarmEngine
|
|
45
45
|
@scale_y = 1
|
46
46
|
end
|
47
47
|
|
48
|
-
@width = _width || @image.width
|
49
|
-
@height = _height || @image.height
|
48
|
+
@width = _width || (@image.width * @scale_x).floor
|
49
|
+
@height = _height || (@image.height * @scale_y).floor
|
50
50
|
|
51
51
|
update_background
|
52
52
|
end
|
@@ -52,6 +52,7 @@ module CyberarmEngine
|
|
52
52
|
@marquee_animation_time = Gosu.milliseconds if @marquee_offset > range
|
53
53
|
|
54
54
|
update_background
|
55
|
+
root.gui_state.request_repaint
|
55
56
|
end
|
56
57
|
|
57
58
|
def type=(type)
|
@@ -77,9 +78,13 @@ module CyberarmEngine
|
|
77
78
|
def value=(decimal)
|
78
79
|
raise "value must be number" unless decimal.is_a?(Numeric)
|
79
80
|
|
81
|
+
old_value = @fraction
|
82
|
+
|
80
83
|
@fraction = decimal.clamp(0.0, 1.0)
|
81
84
|
update_background
|
82
85
|
|
86
|
+
root.gui_state.request_repaint if @fraction != old_value
|
87
|
+
|
83
88
|
publish(:changed, @fraction)
|
84
89
|
@fraction
|
85
90
|
end
|
@@ -36,6 +36,9 @@ module CyberarmEngine
|
|
36
36
|
@text.color = @style.color
|
37
37
|
end
|
38
38
|
|
39
|
+
old_width = @width
|
40
|
+
old_height = @height
|
41
|
+
|
39
42
|
@width = 0
|
40
43
|
@height = 0
|
41
44
|
|
@@ -79,6 +82,8 @@ module CyberarmEngine
|
|
79
82
|
end
|
80
83
|
|
81
84
|
update_background
|
85
|
+
|
86
|
+
root.gui_state.request_repaint if @width != old_width || @height != old_height
|
82
87
|
end
|
83
88
|
|
84
89
|
def handle_text_wrapping(max_width)
|
@@ -159,6 +164,7 @@ module CyberarmEngine
|
|
159
164
|
end
|
160
165
|
|
161
166
|
def value=(value)
|
167
|
+
old_value = @raw_text
|
162
168
|
@raw_text = value.to_s.chomp
|
163
169
|
|
164
170
|
old_width = width
|
@@ -170,6 +176,8 @@ module CyberarmEngine
|
|
170
176
|
recalculate
|
171
177
|
end
|
172
178
|
|
179
|
+
root.gui_state.request_repaint if old_value != @raw_text
|
180
|
+
|
173
181
|
publish(:changed, self.value)
|
174
182
|
end
|
175
183
|
end
|
@@ -27,6 +27,8 @@ module CyberarmEngine
|
|
27
27
|
@pending_recalculate_request = false
|
28
28
|
@pending_element_recalculate_requests = []
|
29
29
|
|
30
|
+
@needs_repaint = false
|
31
|
+
|
30
32
|
@menu = nil
|
31
33
|
@min_drag_distance = 0
|
32
34
|
@mouse_pos = Vector.new
|
@@ -55,7 +57,7 @@ module CyberarmEngine
|
|
55
57
|
@menu.draw
|
56
58
|
end
|
57
59
|
|
58
|
-
if @tip.value.length.positive?
|
60
|
+
if @tip && @tip.value.length.positive?
|
59
61
|
Gosu.flush
|
60
62
|
|
61
63
|
@tip.draw
|
@@ -66,6 +68,12 @@ module CyberarmEngine
|
|
66
68
|
|
67
69
|
@root_container.debug_draw
|
68
70
|
end
|
71
|
+
|
72
|
+
@needs_repaint = false
|
73
|
+
end
|
74
|
+
|
75
|
+
def needs_repaint?
|
76
|
+
@needs_repaint
|
69
77
|
end
|
70
78
|
|
71
79
|
def update
|
@@ -88,9 +96,19 @@ module CyberarmEngine
|
|
88
96
|
end
|
89
97
|
|
90
98
|
@menu&.update
|
99
|
+
|
91
100
|
super
|
92
101
|
|
102
|
+
if @active_width != window.width || @active_height != window.height
|
103
|
+
request_recalculate
|
104
|
+
@root_container.publish(:window_size_changed)
|
105
|
+
end
|
106
|
+
|
107
|
+
@active_width = window.width
|
108
|
+
@active_height = window.height
|
109
|
+
|
93
110
|
return unless window.has_focus?
|
111
|
+
return unless window.current_state == self
|
94
112
|
|
95
113
|
new_mouse_over = @menu.hit_element?(window.mouse_x, window.mouse_y) if @menu
|
96
114
|
new_mouse_over ||= @root_container.hit_element?(window.mouse_x, window.mouse_y)
|
@@ -127,14 +145,6 @@ module CyberarmEngine
|
|
127
145
|
|
128
146
|
@last_mouse_pos = Vector.new(window.mouse_x, window.mouse_y)
|
129
147
|
@mouse_pos = @last_mouse_pos.clone
|
130
|
-
|
131
|
-
if @active_width != window.width || @active_height != window.height
|
132
|
-
request_recalculate
|
133
|
-
@root_container.publish(:window_size_changed)
|
134
|
-
end
|
135
|
-
|
136
|
-
@active_width = window.width
|
137
|
-
@active_height = window.height
|
138
148
|
end
|
139
149
|
|
140
150
|
def button_down(id)
|
@@ -253,6 +263,12 @@ module CyberarmEngine
|
|
253
263
|
@pending_focus_element = element
|
254
264
|
end
|
255
265
|
|
266
|
+
def request_repaint
|
267
|
+
# puts caller[0..4]
|
268
|
+
# puts
|
269
|
+
@needs_repaint = true
|
270
|
+
end
|
271
|
+
|
256
272
|
def show_menu(list_box)
|
257
273
|
@menu = list_box
|
258
274
|
end
|
@@ -41,6 +41,7 @@ module CyberarmEngine
|
|
41
41
|
|
42
42
|
@states = []
|
43
43
|
@exit_on_opengl_error = false
|
44
|
+
preload_default_shaders if respond_to?(:preload_default_shaders)
|
44
45
|
|
45
46
|
setup if defined?(setup)
|
46
47
|
end
|
@@ -141,10 +142,14 @@ module CyberarmEngine
|
|
141
142
|
|
142
143
|
def pop_state
|
143
144
|
@states.pop
|
145
|
+
|
146
|
+
current_state.request_repaint if current_state&.is_a?(GuiState)
|
144
147
|
end
|
145
148
|
|
146
149
|
def shift_state
|
147
150
|
@states.shift
|
151
|
+
|
152
|
+
current_state.request_repaint if current_state&.is_a?(GuiState)
|
148
153
|
end
|
149
154
|
|
150
155
|
def has_focus?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyberarm_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyberarm
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -108,6 +108,11 @@ files:
|
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
|
+
- assets/shaders/fragment/g_buffer.glsl
|
112
|
+
- assets/shaders/fragment/lighting.glsl
|
113
|
+
- assets/shaders/include/light_struct.glsl
|
114
|
+
- assets/shaders/vertex/g_buffer.glsl
|
115
|
+
- assets/shaders/vertex/lighting.glsl
|
111
116
|
- assets/textures/default.png
|
112
117
|
- assets/textures/logo.png
|
113
118
|
- bin/console
|