$npx -y skills add thedivergentai/GD-Agentic-Skills --skill godot-adapt-mobile-to-desktopExpert patterns for scaling mobile games to desktop including mouse/keyboard controls, increased resolution and graphical fidelity, expanded UI layouts, settings menus, window management, and platform-specific features. Use when creating desktop ports or cross-platform releases.
| 1 | ## Godot 4.7 Baseline |
| 2 | |
| 3 | - Expert patterns in this skill target **Godot 4.7+** (stable, 2026-06-18). |
| 4 | - Consult the [Godot 4.7 migration guide](https://docs.godotengine.org/en/4.7/tutorials/migrating/upgrading_to_godot_4.7.html) when upgrading projects from 4.6. |
| 5 | - **NEVER** assume 4.6 defaults (stretch mode, audio area_mask, RichTextLabel percent flags) without checking 4.7 migration notes. |
| 6 | |
| 7 | # Adapt: Mobile to Desktop |
| 8 | |
| 9 | Expert guidance for scaling mobile games to desktop platforms. |
| 10 | |
| 11 | ## NEVER Do |
| 12 | |
| 13 | - **NEVER keep touch-only controls** — Add mouse/keyboard alternatives. Touch controls on desktop feel awkward and limit precision. |
| 14 | - **NEVER lock to mobile resolution** — Desktop can handle 1920x1080+ and higher frame rates. Upscale UI, increase render distance. |
| 15 | - **NEVER hide graphics settings** — Desktop players expect quality options (resolution, VSync, shadows, anti-aliasing). |
| 16 | - **NEVER use mobile-sized UI** — Touch targets (44pt) are too large for mouse. Reduce button/text size by 30-50%. |
| 17 | - **NEVER forget window management** — Players expect fullscreen, borderless, maximize, and multi-monitor support. |
| 18 | |
| 19 | --- |
| 20 | |
| 21 | ## Available Scripts |
| 22 | |
| 23 | > **MANDATORY**: Read the appropriate script before implementing the corresponding pattern. |
| 24 | |
| 25 | ### [mouse_capture_look.gd](scripts/mouse_capture_look.gd) |
| 26 | Expert Mouse Capture Controller that completely overrides mobile touch/swipe logic by accumulating `InputEventMouseMotion.relative` against pitch/yaw variables while clamped. |
| 27 | |
| 28 | ### [dynamic_window_manager.gd](scripts/dynamic_window_manager.gd) |
| 29 | Crucial lifecycle manager handling the expectation of PC gamers to toggle between Windowed, Fullscreen Exclusive, and modern Borderless Fullscreen via `DisplayServer` flags. |
| 30 | |
| 31 | ### [keybinding_remapper.gd](scripts/keybinding_remapper.gd) |
| 32 | Complete runtime input remapper. Mobile relies on hardcoded touch zones, but PC requires the ability to swap WASD to custom keycodes via `InputMap` and saving to `ConfigFile`. |
| 33 | |
| 34 | ### [cursor_state_manager.gd](scripts/cursor_state_manager.gd) |
| 35 | Hardware cursor state machine. Replaces the default OS arrow with custom `Texture2D` hardware cursors and handles hiding the cursor during combat while freeing it in menus. |
| 36 | |
| 37 | ### [uncapped_framerate.gd](scripts/uncapped_framerate.gd) |
| 38 | Expert VSync and FPS unlocker. Mobile locks at 60FPS to save battery; PC gamers expect the ability to disable VSync and unlock `Engine.max_fps` for 144Hz+ monitors. |
| 39 | |
| 40 | ### [resolution_dropdown.gd](scripts/resolution_dropdown.gd) |
| 41 | Query engine utilizing `DisplayServer.screen_get_size` to build an OptionButton of supported native 16:9, 21:9, and 4K resolutions without exceeding the user's physical monitor. |
| 42 | |
| 43 | ### [desktop_ui_scaler.gd](scripts/desktop_ui_scaler.gd) |
| 44 | Recursive SceneTree crawler that scales down massive thumb-sized mobile buttons by a percentage shrink factor specifically on Desktop builds while retaining their anchor points. |
| 45 | |
| 46 | ### [scroll_wheel_zoom.gd](scripts/scroll_wheel_zoom.gd) |
| 47 | Replaces the mobile Pinch-to-Zoom gesture with discrete physical mouse wheel ticks, smoothly interpolating the Camera2D zoom continuously via `delta`. |
| 48 | |
| 49 | ### [quit_confirmation.gd](scripts/quit_confirmation.gd) |
| 50 | Hooks `get_tree().set_auto_accept_quit(false)` to intercept the OS-level 'X' window button, pausing the game and prompting the user to save instead of instantly terminating like mobile. |
| 51 | |
| 52 | ### [multi_monitor_handling.gd](scripts/multi_monitor_handling.gd) |
| 53 | Advanced PC window placement script that queries the mouse position to identify the active screen on multi-monitor setups, ensuring the game launches exactly where the user is looking. |
| 54 | |
| 55 | --- |
| 56 | |
| 57 | ## Control Scheme Expansion |
| 58 | |
| 59 | ### Touch → Mouse Conversion |
| 60 | |
| 61 | ```gdscript |
| 62 | # Mobile: Virtual joystick for movement |
| 63 | var direction: Vector2 = virtual_joystick.get_direction() |
| 64 | |
| 65 | # ⬇️ Desktop: WASD + mouse aim |
| 66 | |
| 67 | extends CharacterBody2D |
| 68 | |
| 69 | func _physics_process(delta: float) -> void: |
| 70 | # Keyboard movement (WASD) |
| 71 | var input := Input.get_vector("move_left", "move_right", "move_up", "move_down") |
| 72 | velocity = input.normalized() * SPEED |
| 73 | |
| 74 | # Mouse aiming |
| 75 | var mouse_pos := get_global_mouse_position() |
| 76 | look_at(mouse_pos) |
| 77 | |
| 78 | move_and_slide() |
| 79 | |
| 80 | # Configure Project Settings → Input Map: |
| 81 | # move_left: A, Left Arrow |
| 82 | # move_right: D, Right Arrow |
| 83 | # move_up: W, Up Arrow |
| 84 | # move_down: S, Down Arrow |
| 85 | ``` |
| 86 | |
| 87 | ### Add Keyboard Shortcuts |
| 88 | |
| 89 | ```gdscript |
| 90 | # desktop_shortcuts.gd |
| 91 | extends Node |
| 92 | |
| 93 | func _input(event: InputEvent) -> void: |
| 94 | if event.is_action_pressed("toggle_fullscreen"): |
| 95 | toggle_fulls |