In the middle of it
BIN
default_avatars/hat_guy/eyes_closed.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
34
default_avatars/hat_guy/eyes_closed.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dsir4ejkj8puy"
|
||||
path="res://.godot/imported/eyes_closed.png-12c4263a2a91a0534f989bc9275bbd7d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/eyes_closed.png"
|
||||
dest_files=["res://.godot/imported/eyes_closed.png-12c4263a2a91a0534f989bc9275bbd7d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/eyes_open.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
34
default_avatars/hat_guy/eyes_open.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://4x3v7t763j2w"
|
||||
path="res://.godot/imported/eyes_open.png-b2522b2294c35a5797861e391ceb2ff8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/eyes_open.png"
|
||||
dest_files=["res://.godot/imported/eyes_open.png-b2522b2294c35a5797861e391ceb2ff8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/eyes_open_speaking.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
34
default_avatars/hat_guy/eyes_open_speaking.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://brvu2i85mnr65"
|
||||
path="res://.godot/imported/eyes_open_speaking.png-6409987f612bc32d553abbf3f7cc6ff1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/eyes_open_speaking.png"
|
||||
dest_files=["res://.godot/imported/eyes_open_speaking.png-6409987f612bc32d553abbf3f7cc6ff1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/hair.png
Normal file
After Width: | Height: | Size: 55 KiB |
34
default_avatars/hat_guy/hair.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b7d05wfdvqbmo"
|
||||
path="res://.godot/imported/hair.png-f53ac7b29afa34df1fea5a0fb7b9f2c9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/hair.png"
|
||||
dest_files=["res://.godot/imported/hair.png-f53ac7b29afa34df1fea5a0fb7b9f2c9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/hat.png
Normal file
After Width: | Height: | Size: 43 KiB |
34
default_avatars/hat_guy/hat.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://uvf6v845pqtw"
|
||||
path="res://.godot/imported/hat.png-ff3f9691c4c57fb49dc1f851fddd1b84.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/hat.png"
|
||||
dest_files=["res://.godot/imported/hat.png-ff3f9691c4c57fb49dc1f851fddd1b84.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
9
default_avatars/hat_guy/hat_guy.tres
Normal file
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="AvatarData" load_steps=3 format=3 uid="uid://b7ss481m4x0a4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b73on8ic2acsv" path="res://scripts/avatar_data.gd" id="1_re035"]
|
||||
[ext_resource type="Script" uid="uid://b07e67yn4uh6d" path="res://scripts/sprite_data.gd" id="2_cjoo4"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_re035")
|
||||
sprites = Array[ExtResource("2_cjoo4")]([])
|
||||
metadata/_custom_type_script = "uid://b73on8ic2acsv"
|
BIN
default_avatars/hat_guy/head.png
Normal file
After Width: | Height: | Size: 21 KiB |
34
default_avatars/hat_guy/head.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://kpb0f3fkimex"
|
||||
path="res://.godot/imported/head.png-e2914718512a4a40501f60740e5be3e5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/head.png"
|
||||
dest_files=["res://.godot/imported/head.png-e2914718512a4a40501f60740e5be3e5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/mouth_closed.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
34
default_avatars/hat_guy/mouth_closed.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bgomt0jm4rca3"
|
||||
path="res://.godot/imported/mouth_closed.png-153cd499e9f8e1d7fedcfc4d6ff19f09.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/mouth_closed.png"
|
||||
dest_files=["res://.godot/imported/mouth_closed.png-153cd499e9f8e1d7fedcfc4d6ff19f09.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/mouth_open.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
34
default_avatars/hat_guy/mouth_open.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://jiw5ygsr5eus"
|
||||
path="res://.godot/imported/mouth_open.png-18177d9c2351b894e0bd89033dcbd8bb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/mouth_open.png"
|
||||
dest_files=["res://.godot/imported/mouth_open.png-18177d9c2351b894e0bd89033dcbd8bb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
default_avatars/hat_guy/torso.png
Normal file
After Width: | Height: | Size: 19 KiB |
34
default_avatars/hat_guy/torso.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bse3li76fy8pi"
|
||||
path="res://.godot/imported/torso.png-d468966dc8d74a1a04ac15ce2dcb5d59.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://default_avatars/hat_guy/torso.png"
|
||||
dest_files=["res://.godot/imported/torso.png-d468966dc8d74a1a04ac15ce2dcb5d59.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -1,6 +1,6 @@
|
|||
[configuration]
|
||||
entry_symbol = "gdext_rust_init"
|
||||
compatibility_minimum = 4.4
|
||||
compatibility_minimum = 4.1
|
||||
reloadable = true
|
||||
|
||||
[libraries]
|
||||
|
|
|
@ -1,28 +1,56 @@
|
|||
use std::collections::HashSet;
|
||||
|
||||
use device_query::{DeviceQuery, DeviceState, Keycode};
|
||||
use godot::{global::Key, prelude::*};
|
||||
use godot::{classes::Engine, global::Key, prelude::*};
|
||||
|
||||
struct MyExtension;
|
||||
|
||||
const SINGLETON_NAME: &str = "BackgroundInputCapture";
|
||||
|
||||
#[gdextension]
|
||||
unsafe impl ExtensionLibrary for MyExtension {}
|
||||
unsafe impl ExtensionLibrary for MyExtension {
|
||||
fn on_level_init(_level: InitLevel) {
|
||||
Engine::singleton()
|
||||
.register_singleton(SINGLETON_NAME, &BackgroundInputCapture::new_alloc());
|
||||
}
|
||||
|
||||
fn on_level_deinit(_level: InitLevel) {
|
||||
Engine::singleton().unregister_singleton(SINGLETON_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(GodotClass)]
|
||||
#[class(init, base = Node)]
|
||||
#[class(init, base = Object)]
|
||||
pub struct BackgroundInputCapture {
|
||||
device_state: DeviceState,
|
||||
base: Base<Node>,
|
||||
pressed_keys: HashSet<Keycode>,
|
||||
base: Base<Object>,
|
||||
}
|
||||
|
||||
#[godot_api]
|
||||
impl BackgroundInputCapture {
|
||||
#[func]
|
||||
pub fn get_keys(&mut self) -> Vec<i32> {
|
||||
self.device_state
|
||||
.get_keys()
|
||||
pub fn get_keys(&mut self) -> Dictionary {
|
||||
let keys: HashSet<Keycode> = self.device_state.get_keys().into_iter().collect();
|
||||
let just_pressed = keys.difference(&self.pressed_keys);
|
||||
let just_released = self.pressed_keys.difference(&keys);
|
||||
let output = just_pressed
|
||||
.into_iter()
|
||||
.filter_map(|k| {
|
||||
.filter_map(|k| Some((keycode_to_key(k)?, true)))
|
||||
.chain(
|
||||
just_released
|
||||
.into_iter()
|
||||
.filter_map(|k| Some((keycode_to_key(k)?, false))),
|
||||
)
|
||||
.collect();
|
||||
self.pressed_keys = keys;
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
fn keycode_to_key(key: &Keycode) -> Option<i32> {
|
||||
Some(
|
||||
match k {
|
||||
match key {
|
||||
Keycode::Key0 => Key::KEY_0,
|
||||
Keycode::Key1 => Key::KEY_1,
|
||||
Keycode::Key2 => Key::KEY_2,
|
||||
|
@ -138,7 +166,4 @@ impl BackgroundInputCapture {
|
|||
}
|
||||
.to_godot(),
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,13 +48,6 @@ var bounceChange = 0.0
|
|||
#IMPORTANT
|
||||
var fileSystemOpen = false
|
||||
|
||||
#background input capture
|
||||
signal emptiedCapture
|
||||
signal pressedKey
|
||||
var costumeKeys = ["1","2","3","4","5","6","7","8","9","0"]
|
||||
signal spriteVisToggles(keysPressed:Array[String])
|
||||
signal all_keys_released
|
||||
|
||||
func _ready():
|
||||
Global.main = self
|
||||
Global.fail = $Failed
|
||||
|
@ -133,9 +126,6 @@ func _ready():
|
|||
camera.position = origin.position
|
||||
|
||||
func _process(delta):
|
||||
var keys = $BackgroundInputCapture.get_keys()
|
||||
process_key_presses(keys)
|
||||
bgInputSprite(keys)
|
||||
var hold = origin.get_parent().position.y
|
||||
|
||||
origin.get_parent().position.y += yVel * 0.0166
|
||||
|
@ -582,51 +572,3 @@ func _on_button_pressed():
|
|||
|
||||
func _on_settings_buttons_pressed():
|
||||
settingsMenu.visible = !settingsMenu.visible
|
||||
|
||||
|
||||
func process_key_presses(keys_pressed):
|
||||
var keyStrings = []
|
||||
|
||||
for i in keys_pressed:
|
||||
keyStrings.append(OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i))
|
||||
|
||||
if fileSystemOpen:
|
||||
return
|
||||
|
||||
if keyStrings.size() <= 0:
|
||||
emit_signal("emptiedCapture")
|
||||
return
|
||||
|
||||
if settingsMenu.awaitingCostumeInput >= 0:
|
||||
|
||||
if keyStrings[0] == "Keycode1":
|
||||
if !settingsMenu.hasMouse:
|
||||
emit_signal("pressedKey")
|
||||
return
|
||||
|
||||
var currentButton = costumeKeys[settingsMenu.awaitingCostumeInput]
|
||||
costumeKeys[settingsMenu.awaitingCostumeInput] = keyStrings[0]
|
||||
Saving.settings["costumeKeys"] = costumeKeys
|
||||
Global.pushUpdate("Changed costume " + str(settingsMenu.awaitingCostumeInput+1) + " hotkey from \"" + currentButton + "\" to \"" + keyStrings[0] + "\"")
|
||||
emit_signal("pressedKey")
|
||||
|
||||
for key in keyStrings:
|
||||
var i = costumeKeys.find(key)
|
||||
if i >= 0:
|
||||
changeCostume(i+1)
|
||||
|
||||
|
||||
# Handles background input for sprites
|
||||
func bgInputSprite(keys_pressed: Array[Key]):
|
||||
if fileSystemOpen:
|
||||
return
|
||||
|
||||
if keys_pressed.size() <= 0:
|
||||
emit_signal("all_keys_released")
|
||||
return
|
||||
|
||||
spriteVisToggles.emit(
|
||||
keys_pressed.map(
|
||||
func(i) -> String: return OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -619,8 +619,6 @@ texture = ExtResource("24_joqmn")
|
|||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(360, 360)
|
||||
|
||||
[node name="BackgroundInputCapture" type="BackgroundInputCapture" parent="."]
|
||||
|
||||
[node name="PushUpdates" parent="." instance=ExtResource("30_q43vl")]
|
||||
z_index = 4090
|
||||
position = Vector2(0, 720)
|
||||
|
|
|
@ -26,10 +26,11 @@ driver/enable_input=true
|
|||
|
||||
[autoload]
|
||||
|
||||
Saving="*res://autoload/saving.gd"
|
||||
Global="*res://autoload/global.gd"
|
||||
Config="*res://scripts/autoload/config.gd"
|
||||
Global="*res://scripts/autoload/global.gd"
|
||||
ElgatoStreamDeck="*res://addons/godot-streamdeck-addon/singleton.gd"
|
||||
DefaultAvatarData="*res://autoload/defaultAvatarData.gd"
|
||||
DefaultAvatarData="*res://scripts/autoload/defaultAvatarData.gd"
|
||||
InputHandler="*res://scripts/autoload/input_handler.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
|
|
|
@ -40,57 +40,22 @@ var default = {
|
|||
"2": { "drag": 4, "identification": 928082759, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/hair.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": -2 }, "3": { "drag": 0, "identification": 346749260, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "4": { "drag": 0, "identification": 348929106, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "5": { "drag": 0, "identification": 66364456, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "6": { "drag": 0, "identification": 261040117, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "7": { "drag": 0, "identification": 291459997, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye3.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 2, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "8": { "drag": 0, "identification": 148065686, "offset": "Vector2(-74, 92)", "parentId": 456157398, "path": "user://defaultAvatar/hat.png", "pos": "Vector2(72, -89)", "rotDrag": -2, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 2 } }
|
||||
|
||||
|
||||
var settings = {
|
||||
"newUser":true,
|
||||
"lastAvatar":"",
|
||||
"volume":0.185,
|
||||
"sense":0.25,
|
||||
"windowSize":Vector2i(1280,720),
|
||||
"useStreamDeck":false,
|
||||
"bounce":250,
|
||||
"gravity":1000,
|
||||
"maxFPS":60,
|
||||
"secondsToMicReset":180,
|
||||
"backgroundColor":var_to_str(Color(0.0,0.0,0.0,0.0)),
|
||||
"filtering":false,
|
||||
"costumeKeys":["1","2","3","4","5","6","7","8","9","0"],
|
||||
"blinkSpeed":1.0,
|
||||
"blinkChance":200,
|
||||
"bounceOnCostumeChange":false,
|
||||
}
|
||||
var settings: Settings = Settings.new()
|
||||
|
||||
var settingsPath = "user://settings.pngtp"
|
||||
|
||||
func _ready():
|
||||
var datas = read_save(settingsPath)
|
||||
if datas == null:
|
||||
return
|
||||
else:
|
||||
settings = datas.duplicate()
|
||||
settings = load(settingsPath)
|
||||
|
||||
func _exit_tree():
|
||||
write_settings(settingsPath)
|
||||
|
||||
|
||||
func read_save(path):
|
||||
|
||||
if path == "default":
|
||||
return DefaultAvatarData.data
|
||||
|
||||
|
||||
if OS.has_feature('web'):
|
||||
var JSONstr = JavaScriptBridge.eval("window.localStorage.getItem('" + key + "');")
|
||||
if (JSONstr):
|
||||
return JSON.parse_string(JSONstr)
|
||||
else:
|
||||
return null
|
||||
else:
|
||||
var file = FileAccess.open(path, FileAccess.READ)
|
||||
if not file:
|
||||
return null
|
||||
var newData = JSON.parse_string(file.get_as_text())
|
||||
file.close()
|
||||
return newData
|
||||
return load(path)
|
||||
|
||||
func write_save(path):
|
||||
if OS.has_feature('web'):
|
77
scripts/autoload/input_handler.gd
Normal file
|
@ -0,0 +1,77 @@
|
|||
# Handles background inputs (inputs when unfocused)
|
||||
|
||||
extends Node
|
||||
|
||||
signal key_pressed(key: Key)
|
||||
signal key_released(key: Key)
|
||||
signal all_keys_released
|
||||
#background input capture
|
||||
signal emptiedCapture
|
||||
signal pressedKey
|
||||
var costumeKeys = ["1","2","3","4","5","6","7","8","9","0"]
|
||||
|
||||
var pressed_keys: Array[Key] = []
|
||||
|
||||
func should_fire_signal() -> bool:
|
||||
return get_viewport().gui_get_focus_owner() == null or not DisplayServer.window_is_focused()
|
||||
|
||||
func _process(_delta):
|
||||
# This is a Dictionary[Key, bool] but I can't return typed dicts nor cast them
|
||||
var keys = BackgroundInputCapture.get_keys()
|
||||
for key in keys:
|
||||
if keys[key]:
|
||||
pressed_keys.append(key)
|
||||
if should_fire_signal():
|
||||
key_pressed.emit(key)
|
||||
else:
|
||||
pressed_keys.erase(key)
|
||||
if should_fire_signal():
|
||||
key_released.emit(key)
|
||||
#process_key_presses(keys)
|
||||
#bgInputSprite(keys)
|
||||
#
|
||||
#func process_key_presses(keys_pressed: Dictionary[Key, bool]):
|
||||
#if Global.main.fileSystemOpen:
|
||||
#return
|
||||
#
|
||||
#var keyStrings = keys_pressed.map(
|
||||
#func(i) -> String: return OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i)
|
||||
#)
|
||||
#
|
||||
#if keyStrings.size() <= 0:
|
||||
#emit_signal("emptiedCapture")
|
||||
#return
|
||||
#
|
||||
#if settingsMenu.awaitingCostumeInput >= 0:
|
||||
#
|
||||
#if keyStrings[0] == "Keycode1":
|
||||
#if !settingsMenu.hasMouse:
|
||||
#emit_signal("pressedKey")
|
||||
#return
|
||||
#
|
||||
#var currentButton = costumeKeys[settingsMenu.awaitingCostumeInput]
|
||||
#costumeKeys[settingsMenu.awaitingCostumeInput] = keyStrings[0]
|
||||
#Saving.settings["costumeKeys"] = costumeKeys
|
||||
#Global.pushUpdate("Changed costume " + str(settingsMenu.awaitingCostumeInput+1) + " hotkey from \"" + currentButton + "\" to \"" + keyStrings[0] + "\"")
|
||||
#emit_signal("pressedKey")
|
||||
#
|
||||
#for key in keyStrings:
|
||||
#var i = costumeKeys.find(key)
|
||||
#if i >= 0:
|
||||
#changeCostume(i+1)
|
||||
#
|
||||
#
|
||||
## Handles background input for sprites
|
||||
#func bgInputSprite(keys_pressed: Dictionary[Key, bool]):
|
||||
#if fileSystemOpen:
|
||||
#return
|
||||
#
|
||||
#if keys_pressed.size() <= 0:
|
||||
#emit_signal("all_keys_released")
|
||||
#return
|
||||
#
|
||||
#spriteVisToggles.emit(
|
||||
#keys_pressed.map(
|
||||
#func(i) -> String: return OS.get_keycode_string(i) if !OS.get_keycode_string(i).strip_edges().is_empty() else "Keycode" + str(i)
|
||||
#)
|
||||
#)
|
1
scripts/autoload/input_handler.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://y12b1vin2hpt
|
4
scripts/avatar_data.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends Resource
|
||||
class_name AvatarData
|
||||
|
||||
@export var sprites: Array[SpriteData] = []
|
1
scripts/avatar_data.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b73on8ic2acsv
|
18
scripts/settings.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
extends Resource
|
||||
class_name Settings
|
||||
|
||||
@export_global_file var lastAvatar: String = ""
|
||||
@export_range(0, 1, 0.05) var volume: float = 0.185
|
||||
@export_range(0, 1, 0.05) var sense = 0.25
|
||||
@export var windowSize = Vector2i(1280, 720)
|
||||
@export var useStreamDeck = false
|
||||
@export var bounce = 250
|
||||
@export var gravity = 1000
|
||||
@export var maxFPS: int = 60
|
||||
@export var secondsToMicReset: float = 180
|
||||
@export var backgroundColor: Color = Color.TRANSPARENT
|
||||
@export var filtering = false
|
||||
@export var costumeKeys: Array[Key] = [KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0]
|
||||
@export var blinkSpeed: float = 1.0
|
||||
@export var blinkChance = 200
|
||||
@export var bounceOnCostumeChange = false
|
1
scripts/settings.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://dmeqvexvccsav
|
26
scripts/sprite_data.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends Resource
|
||||
class_name SpriteData
|
||||
|
||||
@export var anim_speed = 0
|
||||
@export var clipped = false
|
||||
@export var costume_layers: Array[bool] = [true, true, true, true, true, true, true, true, true, true]
|
||||
@export var drag = 0
|
||||
@export var frames = 1
|
||||
@export var ignore_bounce = false
|
||||
@export var image: Texture
|
||||
@export var offset = Vector2(0, 0)
|
||||
@export_global_file var path = "user://defaultAvatar/body.png"
|
||||
@export var pos = Vector2(0, 0)
|
||||
@export var r_limit_max = 180
|
||||
@export var r_limit_min = -180
|
||||
@export var rot_drag = 0
|
||||
@export var show_blink = 0
|
||||
@export var show_talk = 0
|
||||
@export var stretch_amount = 0.25
|
||||
@export var type = "sprite"
|
||||
@export var x_amp = 9
|
||||
@export var x_frq = 0.004
|
||||
@export var y_amp = 11
|
||||
@export var y_frq = 0.008
|
||||
@export var zindex = -1
|
||||
@export var children: Array[SpriteData] = []
|
1
scripts/sprite_data.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b07e67yn4uh6d
|
|
@ -1,11 +0,0 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D noise_texture:repeat_enable;
|
||||
uniform float distortion_strengh: hint_range(0, 0.1) = 1.0;
|
||||
uniform float speed: hint_range(0.1, 10) = 1.0;
|
||||
|
||||
void fragment() {
|
||||
vec4 noise_pixel = texture(noise_texture, UV + floor(TIME*speed)/3.0);
|
||||
vec2 uv_offset = (noise_pixel.rg * 2.0 - 1.0) * distortion_strengh;
|
||||
COLOR = texture(TEXTURE, UV + uv_offset);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
uid://ddgp8n4l7veuh
|
|
@ -81,11 +81,10 @@ var clipped = false
|
|||
var tick = 0
|
||||
|
||||
#Vis toggle
|
||||
var toggle = "null"
|
||||
var toggle: Key = KEY_NONE
|
||||
|
||||
func _ready():
|
||||
|
||||
Global.main.spriteVisToggles.connect(visToggle)
|
||||
InputHandler.key_pressed.connect(visToggle)
|
||||
|
||||
var img = Image.new()
|
||||
var err = img.load(path)
|
||||
|
@ -396,8 +395,8 @@ func getAllLinkedSprites():
|
|||
linkedSprites.append(node)
|
||||
return linkedSprites
|
||||
|
||||
func visToggle(keys):
|
||||
if keys.has(toggle):
|
||||
func visToggle(key: Key):
|
||||
if key == toggle:
|
||||
$WobbleOrigin/DragOrigin.visible = !$WobbleOrigin/DragOrigin.visible
|
||||
|
||||
func makeVis():
|
||||
|
|
|
@ -342,15 +342,14 @@ func _on_clip_linked_toggled(button_pressed):
|
|||
|
||||
|
||||
func _on_delete_pressed():
|
||||
Global.heldSprite.toggle = "null"
|
||||
$VisToggle/setToggle/Label.text = "toggle: \"" + Global.heldSprite.toggle + "\""
|
||||
Global.heldSprite.toggle = KEY_NONE
|
||||
$VisToggle/setToggle/Label.text = "toggle: \"%s\"" % OS.get_keycode_string(Global.heldSprite.toggle)
|
||||
Global.heldSprite.makeVis()
|
||||
|
||||
func _on_set_toggle_pressed():
|
||||
$VisToggle/setToggle/Label.text = "toggle: AWAITING INPUT"
|
||||
await Global.main.all_keys_released
|
||||
await InputHandler.all_keys_released
|
||||
|
||||
var keys = await Global.main.spriteVisToggles
|
||||
var key = keys[0]
|
||||
var key = await InputHandler.key_pressed
|
||||
Global.heldSprite.toggle = key
|
||||
$VisToggle/setToggle/Label.text = "toggle: \"" + Global.heldSprite.toggle + "\""
|
||||
$VisToggle/setToggle/Label.text = "toggle: \"%s\"" % OS.get_keycode_string(Global.heldSprite.toggle)
|
||||
|
|