重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
godot-platform-mobile by thedivergentai/gd-agentic-skills
npx skills add https://github.com/thedivergentai/gd-agentic-skills --skill godot-platform-mobile触摸优先的输入、安全区域处理和电池优化定义了移动端开发。
InputEventMouseButton 不可靠。始终使用 InputEventScreenTouch 和 InputEventScreenDrag 以获得高保真的多点触控支持。DisplayServer.get_display_safe_area() 并相应调整关键 UI 的偏移量。size_changed 信号,会导致在可折叠设备或平板电脑方向切换时布局错乱。NOTIFICATION_APPLICATION_PAUSED 将 降至 1。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Engine.max_fpsOS.request_permission() 并使用 OS.get_granted_permissions() 进行验证。VIBRATE 权限,否则振动调用将被忽略。强制要求:在实现相应模式之前,请阅读对应的脚本。
用于捏合缩放和双指旋转的专家级多点触控逻辑。
使用 DisplayServer 插值进行动态安全区域(刘海屏)处理。
通过 NOTIFICATION_APPLICATION_PAUSED 进行电池和热量管理。
适用于 Android/iOS 应用内购买的统一样板代码。
用于移动端触觉反馈的高级振动模式。
专家级的 Android 权限请求和验证逻辑。
使用加速度计和重力传感器融合实现稳定的运动控制。
针对横屏/竖屏切换的自适应 UI 交换。
VRAM 监控和纹理压缩强制执行规则。
用于社交功能的操作系统级原生分享界面集成。
# Replace mouse/keyboard with touch
func _input(event: InputEvent) -> void:
if event is InputEventScreenTouch:
if event.pressed:
on_touch_start(event.position)
else:
on_touch_end(event.position)
elif event is InputEventScreenDrag:
on_touch_drag(event.position, event.relative)
# virtual_joystick.gd
extends Control
signal joystick_moved(direction: Vector2)
var is_pressed := false
var center: Vector2
var touch_index := -1
func _gui_input(event: InputEvent) -> void:
if event is InputEventScreenTouch:
if event.pressed:
is_pressed = true
center = event.position
touch_index = event.index
elif event.index == touch_index:
is_pressed = false
joystick_moved.emit(Vector2.ZERO)
elif event is InputEventScreenDrag and event.index == touch_index:
var direction := (event.position - center).normalized()
joystick_moved.emit(direction)
# Adapt to screen size
func _ready() -> void:
get_viewport().size_changed.connect(_on_viewport_resized)
_on_viewport_resized()
func _on_viewport_resized() -> void:
var viewport_size := get_viewport().get_visible_rect().size
var aspect := viewport_size.x / viewport_size.y
if aspect < 1.5: # Tall screen
$UI.layout_mode = VBoxContainer.LAYOUT_MODE_VERTICAL
else: # Wide screen
$UI.layout_mode = HBoxContainer.LAYOUT_MODE_HORIZONTAL
# Lower frame rate when inactive
func _notification(what: int) -> void:
match what:
NOTIFICATION_APPLICATION_FOCUS_OUT:
Engine.max_fps = 30
NOTIFICATION_APPLICATION_FOCUS_IN:
Engine.max_fps = 60
func apply_safe_area() -> void:
var safe_area := DisplayServer.get_display_safe_area()
# Adjust UI margins
$UI.offset_top = safe_area.position.y
$UI.offset_left = safe_area.position.x
# project.godot mobile settings
[rendering]
renderer/rendering_method="mobile"
textures/vram_compression/import_etc2_astc=true
[display]
window/handheld/orientation="landscape"
godot-export-builds, godot-ui-containers每周安装数
66
代码仓库
GitHub 星标数
68
首次出现
2026年2月10日
安全审计
安装于
opencode63
gemini-cli62
codex62
kimi-cli61
github-copilot61
amp61
Touch-first input, safe area handling, and battery optimization define mobile development.
InputEventMouseButton on mobile is unreliable. Always use InputEventScreenTouch and InputEventScreenDrag for high-fidelity multi-touch support.DisplayServer.get_display_safe_area() and offset critical UI accordingly.size_changed signal leads to broken layouts on foldable devices or tablet orientation shifts.NOTIFICATION_APPLICATION_PAUSED to drop Engine.max_fps to 1.OS.request_permission() and verify with OS.get_granted_permissions().VIBRATE permission is enabled in the export preset.MANDATORY : Read the appropriate script before implementing the corresponding pattern.
Expert multi-touch logic for pinch-to-zoom and two-finger rotation.
Dynamic safe-area (notch) handling using DisplayServer insets.
Battery and heat management via NOTIFICATION_APPLICATION_PAUSED.
Unified boilerplate for Android/iOS In-App Purchases (IAP).
Advanced vibration patterns for mobile haptic feedback.
Expert Android permission requesting and verification logic.
Stable motion controls using Accelerometer and Gravity fusion.
Adaptive UI swapping for Landscape/Portrait transitions.
VRAM monitoring and texture compression enforcement rules.
OS-level native share sheet integration for social features.
# Replace mouse/keyboard with touch
func _input(event: InputEvent) -> void:
if event is InputEventScreenTouch:
if event.pressed:
on_touch_start(event.position)
else:
on_touch_end(event.position)
elif event is InputEventScreenDrag:
on_touch_drag(event.position, event.relative)
# virtual_joystick.gd
extends Control
signal joystick_moved(direction: Vector2)
var is_pressed := false
var center: Vector2
var touch_index := -1
func _gui_input(event: InputEvent) -> void:
if event is InputEventScreenTouch:
if event.pressed:
is_pressed = true
center = event.position
touch_index = event.index
elif event.index == touch_index:
is_pressed = false
joystick_moved.emit(Vector2.ZERO)
elif event is InputEventScreenDrag and event.index == touch_index:
var direction := (event.position - center).normalized()
joystick_moved.emit(direction)
# Adapt to screen size
func _ready() -> void:
get_viewport().size_changed.connect(_on_viewport_resized)
_on_viewport_resized()
func _on_viewport_resized() -> void:
var viewport_size := get_viewport().get_visible_rect().size
var aspect := viewport_size.x / viewport_size.y
if aspect < 1.5: # Tall screen
$UI.layout_mode = VBoxContainer.LAYOUT_MODE_VERTICAL
else: # Wide screen
$UI.layout_mode = HBoxContainer.LAYOUT_MODE_HORIZONTAL
# Lower frame rate when inactive
func _notification(what: int) -> void:
match what:
NOTIFICATION_APPLICATION_FOCUS_OUT:
Engine.max_fps = 30
NOTIFICATION_APPLICATION_FOCUS_IN:
Engine.max_fps = 60
func apply_safe_area() -> void:
var safe_area := DisplayServer.get_display_safe_area()
# Adjust UI margins
$UI.offset_top = safe_area.position.y
$UI.offset_left = safe_area.position.x
# project.godot mobile settings
[rendering]
renderer/rendering_method="mobile"
textures/vram_compression/import_etc2_astc=true
[display]
window/handheld/orientation="landscape"
godot-export-builds, godot-ui-containersWeekly Installs
66
Repository
GitHub Stars
68
First Seen
Feb 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode63
gemini-cli62
codex62
kimi-cli61
github-copilot61
amp61
TanStack Query v5 完全指南:React 数据管理、乐观更新、离线支持
2,500 周安装