godot-platform-desktop by thedivergentai/gd-agentic-skills
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-platform-desktop设置灵活性、窗口管理和键盘/鼠标精度定义了桌面端游戏。
DisplayServer.screen_get_scale() 的情况下手动居中窗口,会导致在高 DPI 显示器上定位错误。WINDOW_MODE_FULLSCREEN(无边框)选项。keycode 进行移动键重绑定 — 使用 physical_keycode 以确保 WASD 在不同国际键盘布局(AZERTY/Dvorak)下都能正确工作。res:// — 在导出的发布版本中,文件系统是只读的。始终使用 user://。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
NOTIFICATION_WM_CLOSE_REQUEST — 未能处理退出信号会导致数据丢失。在 get_tree().quit() 之前拦截并刷新 ConfigFile 数据。OS.low_processor_usage_mode 以防止静态桌面应用产生高 GPU 热量。Engine.has_singleton() 中,以防止在非商店版本中崩溃。WorkerThreadPool。强制要求:在实现相应模式之前,请阅读对应的脚本。
使用 DisplayServer 进行支持 DPI 感知的多显示器窗口定位的专家方案。
使用 ConfigFile 进行持久化 INI 数据存储的生产级设置持久化方案。
使用 physical_keycode 为 AZERTY/Dvorak 键盘布局设计的专家级位置重绑定系统。
安全的 PC SDK 单例包装器(Steamworks/Epic),带有崩溃防护。
专家级的原生操作系统文件对话框和系统警报逻辑。
用于辅助视口/窗口的真正多窗口管理方案。
用于数据刷新和退出防护的安全关闭请求拦截器。
适用于桌面工具和启动器的节能模式优化方案。
用于动态图形预设的 OS 级硬件检测方案。
专家级的原生 shell 命令执行和输出捕获方案。
# settings.gd
extends Control
func _ready() -> void:
load_settings()
apply_settings()
func load_settings() -> void:
var config := ConfigFile.new()
config.load("user://settings.cfg")
$Graphics/ResolutionDropdown.selected = config.get_value("graphics", "resolution", 0)
$Graphics/FullscreenCheck.button_pressed = config.get_value("graphics", "fullscreen", false)
$Audio/MasterSlider.value = config.get_value("audio", "master_volume", 1.0)
func save_settings() -> void:
var config := ConfigFile.new()
config.set_value("graphics", "resolution", $Graphics/ResolutionDropdown.selected)
config.set_value("graphics", "fullscreen", $Graphics/FullscreenCheck.button_pressed)
config.set_value("audio", "master_volume", $Audio/MasterSlider.value)
config.save("user://settings.cfg")
func apply_settings() -> void:
# Resolution
var resolutions := [Vector2i(1920, 1080), Vector2i(2560, 1440), Vector2i(3840, 2160)]
var resolution := resolutions[$Graphics/ResolutionDropdown.selected]
get_window().size = resolution
# Fullscreen
if $Graphics/FullscreenCheck.button_pressed:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
# Audio
AudioServer.set_bus_volume_db(0, linear_to_db($Audio/MasterSlider.value))
# Allow players to rebind keys
func rebind_action(action: String, new_key: Key) -> void:
# Remove existing
InputMap.action_erase_events(action)
# Add new
var event := InputEventKey.new()
event.keycode = new_key
InputMap.action_add_event(action, event)
# Save
save_input_map()
# Toggle fullscreen
func toggle_fullscreen() -> void:
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
# Using GodotSteam plugin
var steam_id: int
func _ready() -> void:
if Steam.isSteamRunning():
steam_id = Steam.getSteamID()
Steam.achievement_progress.connect(_on_achievement_progress)
func unlock_achievement(name: String) -> void:
Steam.setAchievement(name)
Steam.storeStats()
user:// 目录godot-export-builds, godot-save-load-systems每周安装量
77
仓库
GitHub 星标数
67
首次出现
2026年2月10日
安全审计
安装于
gemini-cli75
codex74
opencode74
kimi-cli72
github-copilot72
amp72
Settings flexibility, window management, and kb/mouse precision define desktop gaming.
DisplayServer.screen_get_scale() results in incorrect positioning on HiDPI displays.WINDOW_MODE_FULLSCREEN (borderless).keycode for movement rebinds — Use physical_keycode to ensure WASD works correctly across international keyboard layouts (AZERTY/Dvorak).res:// — Filesystem is read-only in exported releases. Always use user://.NOTIFICATION_WM_CLOSE_REQUEST — Failing to handle quit signals causes data loss. Intercept and flush and ConfigFile data before get_tree().quit().OS.low_processor_usage_mode to prevent high GPU heat in static desktop apps.Engine.has_singleton() to prevent crashes in non-store builds.WorkerThreadPool.MANDATORY : Read the appropriate script before implementing the corresponding pattern.
Expert DPI-aware multi-monitor window positioning using DisplayServer.
Production settings persistence using ConfigFile for persistent INI data.
Expert positional rebind system using physical_keycode for AZERTY/Dvorak.
Safe PC SDK singleton wrapper (Steamworks/Epic) with crash guards.
Expert native OS file dialogs and system alerts logic.
True multi-window management for secondary Viewports/Windows.
Safe close-request interceptor for data flushing and exit guards.
Eco mode optimization for desktop tools and launchers.
OS-level hardware detection for dynamic graphics presets.
Expert native shell command execution and output capture.
# settings.gd
extends Control
func _ready() -> void:
load_settings()
apply_settings()
func load_settings() -> void:
var config := ConfigFile.new()
config.load("user://settings.cfg")
$Graphics/ResolutionDropdown.selected = config.get_value("graphics", "resolution", 0)
$Graphics/FullscreenCheck.button_pressed = config.get_value("graphics", "fullscreen", false)
$Audio/MasterSlider.value = config.get_value("audio", "master_volume", 1.0)
func save_settings() -> void:
var config := ConfigFile.new()
config.set_value("graphics", "resolution", $Graphics/ResolutionDropdown.selected)
config.set_value("graphics", "fullscreen", $Graphics/FullscreenCheck.button_pressed)
config.set_value("audio", "master_volume", $Audio/MasterSlider.value)
config.save("user://settings.cfg")
func apply_settings() -> void:
# Resolution
var resolutions := [Vector2i(1920, 1080), Vector2i(2560, 1440), Vector2i(3840, 2160)]
var resolution := resolutions[$Graphics/ResolutionDropdown.selected]
get_window().size = resolution
# Fullscreen
if $Graphics/FullscreenCheck.button_pressed:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
# Audio
AudioServer.set_bus_volume_db(0, linear_to_db($Audio/MasterSlider.value))
# Allow players to rebind keys
func rebind_action(action: String, new_key: Key) -> void:
# Remove existing
InputMap.action_erase_events(action)
# Add new
var event := InputEventKey.new()
event.keycode = new_key
InputMap.action_add_event(action, event)
# Save
save_input_map()
# Toggle fullscreen
func toggle_fullscreen() -> void:
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
# Using GodotSteam plugin
var steam_id: int
func _ready() -> void:
if Steam.isSteamRunning():
steam_id = Steam.getSteamID()
Steam.achievement_progress.connect(_on_achievement_progress)
func unlock_achievement(name: String) -> void:
Steam.setAchievement(name)
Steam.storeStats()
user:// directorygodot-export-builds, godot-save-load-systemsWeekly Installs
77
Repository
GitHub Stars
67
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli75
codex74
opencode74
kimi-cli72
github-copilot72
amp72
Swift Actor 线程安全持久化:构建离线优先应用的编译器强制安全数据层
1,700 周安装
JavaScript专业开发:ES2023+特性、Node.js/Bun后端与异步编程优化
109 周安装
Rocket.net API 集成指南:WordPress 托管平台 API 开发与站点管理
109 周安装
算法艺术生成器 - 使用p5.js创建可复现的生成艺术与创意编程代码
109 周安装
React与Next.js性能优化最佳实践:40+规则提升应用性能
109 周安装
Spline 3D 场景集成指南:React/Next.js/原生JS嵌入与性能优化
109 周安装
威胁建模工具 | STRIDE方法论 | 生成数据流图与威胁登记册 | 安全开发
111 周安装