diff --git a/.gitignore b/.gitignore index bcc84f7..996efcb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # Godot 4+ specific ignores .godot/ -/android/ \ No newline at end of file +/android/ +.idea/ \ No newline at end of file diff --git a/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll b/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll deleted file mode 100644 index c80cff6..0000000 Binary files a/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll and /dev/null differ diff --git a/addons/ingameconsole/GameConsole.tscn b/addons/ingameconsole/GameConsole.tscn index 75aa145..283d204 100644 --- a/addons/ingameconsole/GameConsole.tscn +++ b/addons/ingameconsole/GameConsole.tscn @@ -45,9 +45,11 @@ theme = ExtResource("1_jmwsb") [node name="LogLabel" type="RichTextLabel" parent="Panel/VBoxContainer/MarginContainer"] layout_mode = 2 size_flags_vertical = 3 +focus_mode = 2 theme = ExtResource("1_jmwsb") bbcode_enabled = true scroll_following = true +selection_enabled = true [node name="InputField" type="LineEdit" parent="Panel/VBoxContainer"] layout_mode = 2 diff --git a/assets/core/networking/NetworkManager.gd b/assets/core/networking/NetworkManager.gd new file mode 100644 index 0000000..40a520c --- /dev/null +++ b/assets/core/networking/NetworkManager.gd @@ -0,0 +1,33 @@ +extends Node + +var steamId: int +var username: String +var avatar_texture: ImageTexture + +func _ready() -> void: + var init_result = Steam.steamInit(true, 480) + if init_result["status"] <= 1: + _initialize() + else: + GameConsole.log_error("Steam failed to initialize: " + str(init_result)) + + +func _initialize() -> void: + steamId = Steam.getSteamID() + username = Steam.getFriendPersonaName(steamId) + GameConsole.print_line("Steam ID: " + username) + + Steam.getPlayerAvatar() + Steam.avatar_loaded.connect(_on_avatar_loaded) + + +func _on_avatar_loaded(_user_id: int, avatar_size: int, avatar_buffer: PackedByteArray) -> void: + var avatar_image: Image = Image.create_from_data(avatar_size, avatar_size, false, Image.FORMAT_RGBA8, avatar_buffer) + if avatar_size > 128: + avatar_image.resize(128, 128, Image.INTERPOLATE_LANCZOS) + + + if avatar_image != null: + avatar_texture = ImageTexture.create_from_image(avatar_image) + else: + GameConsole.log_error("Failed to create avatar image!") diff --git a/assets/scenes/main.tscn b/assets/scenes/main.tscn index 3335c58..bcff134 100644 --- a/assets/scenes/main.tscn +++ b/assets/scenes/main.tscn @@ -1,3 +1,8 @@ -[gd_scene format=3 uid="uid://huq7dxk5yvjk"] +[gd_scene load_steps=2 format=3 uid="uid://huq7dxk5yvjk"] + +[ext_resource type="Script" path="res://assets/core/networking/NetworkManager.gd" id="1_dcack"] [node name="Main" type="Node"] + +[node name="NetworkManager" type="Node" parent="."] +script = ExtResource("1_dcack") diff --git a/project.godot b/project.godot index 40f0316..851af80 100644 --- a/project.godot +++ b/project.godot @@ -19,11 +19,19 @@ config/icon="res://assets/icon.png" GameConsole="*res://addons/ingameconsole/GameConsole.tscn" +[debug] + +file_logging/enable_file_logging=true + [display] window/size/viewport_width=1280 window/size/viewport_height=720 +[dotnet] + +project/assembly_name="Steamforged Skies" + [editor_plugins] enabled=PackedStringArray("res://addons/ingameconsole/plugin.cfg")