Skip to content

Commit 89e15df

Browse files
committed
inputui and muzzle flash
1 parent 3d5c574 commit 89e15df

File tree

6,272 files changed

+116556
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,272 files changed

+116556
-1
lines changed

addons/nodot/gui/InputUI.gd

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
@tool
2+
class_name InputUI extends TextureRect
3+
4+
const input_format_names = ["Flairs", "Generic", "Keyboard & Mouse", "Nintendo Switch", "Nintendo Wii", "Nintendo WiiU", "Playdate", "PlayStation Series", "Steam Controller", "Steam Deck", "Xbox Series"]
5+
const input_type_names = ["Default", "Double", "Vector"]
6+
7+
@export_enum("Flairs", "Generic", "Keyboard & Mouse", "Nintendo Switch", "Nintendo Wii", "Nintendo WiiU", "Playdate", "PlayStation Series", "Steam Controller", "Steam Deck", "Xbox Series") var format: int = 2: set = _change_format
8+
@export_enum("Default", "Double", "Vector") var type: int = 0: set = _change_type
9+
@export var input_name: String = "": set = _change_input_name
10+
@export var outline_color: Color = Color.BLACK: set = _change_outline_color
11+
@export var outline_size: float = 3.0: set = _change_outline_size
12+
@export var transparency: float = 1.0: set = _change_transparency
13+
14+
var shader: Shader = ResourceLoader.load("res://addons/nodot/shaders/canvas_outline.gdshader")
15+
var shader_material: ShaderMaterial = ShaderMaterial.new()
16+
17+
func _ready():
18+
shader_material.shader = shader
19+
material = shader_material
20+
set_outline()
21+
22+
func _change_format(new_value: int):
23+
format = new_value
24+
load_material()
25+
26+
func _change_type(new_value: int):
27+
type = new_value
28+
load_material()
29+
30+
func _change_input_name(new_value: String):
31+
input_name = new_value
32+
load_material()
33+
34+
func _change_outline_color(new_value: Color):
35+
outline_color = new_value
36+
set_outline()
37+
38+
func _change_outline_size(new_value: float):
39+
outline_size = new_value
40+
set_outline()
41+
42+
func _change_transparency(new_value: float):
43+
transparency = new_value
44+
set_outline()
45+
46+
func generate_path() -> String:
47+
return "res://addons/nodot/textures/kenney_inputs/%s/%s/%s.png" % [input_format_names[format], input_type_names[type], convert_key(input_name)]
48+
49+
func convert_key(input: String):
50+
if input.contains("Mouse Button"):
51+
return convert_mouse_button(input)
52+
else:
53+
return convert_keyboard_key(input)
54+
55+
func convert_keyboard_key(input: String, outline: bool = false):
56+
var postfix = "_outline" if outline else ""
57+
return "keyboard_%s%s" % [input.to_lower(), postfix]
58+
59+
func convert_mouse_button(input: String):
60+
if input.contains("Left"):
61+
return "mouse_left"
62+
if input.contains("Right"):
63+
return "mouse_right"
64+
if input.contains("Middle"):
65+
return "mouse_scroll"
66+
67+
func load_material():
68+
var file_path := generate_path()
69+
if ResourceLoader.exists(file_path):
70+
var img := ResourceLoader.load(file_path)
71+
texture = img
72+
73+
func set_outline():
74+
shader_material.set_shader_parameter("line_color", outline_color)
75+
shader_material.set_shader_parameter("line_thickness", outline_size)
76+
shader_material.set_shader_parameter("transparency", transparency)

addons/nodot/scenes/menus/debug_watch.tscn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func data_updated(value: Variant, key: String):
3232
if !existing_accordions.keys().has(key):
3333
create_accordion(key)
3434

35-
var new_data = DebugManager.data.getItem(key)
35+
var new_data = DebugManager.data.get_item(key)
3636
for watch_item in new_data:
3737
update_label(key, watch_item, str(new_data[watch_item]))
3838

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
shader_type canvas_item;
2+
3+
uniform vec4 line_color : source_color = vec4(1.0);
4+
uniform float line_thickness : hint_range(0, 10) = 1.0;
5+
uniform float transparency : hint_range(0, 1) = 1.0;
6+
7+
const vec2 OFFSETS[8] = {
8+
vec2(-1, -1), vec2(-1, 0), vec2(-1, 1), vec2(0, -1), vec2(0, 1),
9+
vec2(1, -1), vec2(1, 0), vec2(1, 1)
10+
};
11+
12+
void fragment() {
13+
vec2 size = TEXTURE_PIXEL_SIZE * line_thickness;
14+
float outline = 0.0;
15+
16+
for (int i = 0; i < OFFSETS.length(); i++) {
17+
outline += texture(TEXTURE, UV + size * OFFSETS[i]).a;
18+
}
19+
outline = min(outline, 1.0);
20+
21+
vec4 color = texture(TEXTURE, UV);
22+
COLOR = mix(color, line_color, outline - color.a);
23+
COLOR.a *= transparency;
24+
}
56.2 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://c7hg0mtj3pl6u"
6+
path="res://.godot/imported/kenney-white-smoke-texture-cc0.png-193b900e9cabec95f03356a09bf67a93.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://addons/nodot/textures/kenney-white-smoke-texture-cc0.png"
14+
dest_files=["res://.godot/imported/kenney-white-smoke-texture-cc0.png-193b900e9cabec95f03356a09bf67a93.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
450 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://epcn6gyteej2"
6+
path="res://.godot/imported/controller_battery_empty.png-656cc2404e3b4ea52a56ca0cb97eb598.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://addons/nodot/textures/kenney_inputs/Flairs/Default/controller_battery_empty.png"
14+
dest_files=["res://.godot/imported/controller_battery_empty.png-656cc2404e3b4ea52a56ca0cb97eb598.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
452 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://wq7q8dpy3vby"
6+
path="res://.godot/imported/controller_battery_full.png-0f9c8e88ae6b70242996bedf7f61ff6c.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://addons/nodot/textures/kenney_inputs/Flairs/Default/controller_battery_full.png"
14+
dest_files=["res://.godot/imported/controller_battery_full.png-0f9c8e88ae6b70242996bedf7f61ff6c.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
458 Bytes
Loading

0 commit comments

Comments
 (0)