# Bevy Adapt Desktop To Mobile

Bevy ECS skill for adapting a Bevy desktop game to mobile.

- Repository: https://github.com/thedivergentai/Game-Dev-Agentic-Skills (917 stars)
- Category: Design
- License: LGPL-3.0
- Last updated: 2026-10-16
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-adapt-desktop-to-mobile -g -a claude-code -y`
Codex: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-adapt-desktop-to-mobile -g -a codex -y`
Cursor: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-adapt-desktop-to-mobile -g -a cursor -y`
Gemini CLI: `npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-adapt-desktop-to-mobile -g -a gemini-cli -y`

## Description

Bevy ECS skill for adapting a Bevy desktop game to mobile. Keywords: Bevy, mobile, touch, UI, adapt.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Bevy adapt desktop to mobile

## When to use

Load this when a desktop window game must accept touch and a smaller layout. Platform features are on bevy-platform-mobile.

## ECS shape

- **Input:** `Touches` lists active contacts. Action mapping lives on bevy-input-handling.
- **UI:** enlarge `Node` hit targets and pad the root with a safe-inset `Resource`. `WindowResolution` sets the logical size and an optional scale-factor override. `WindowScaleFactorChanged` reports a live dpi change.
- **Textures:** ASTC is a compressed texture format for mobile GPUs. Upload still goes through `Assets<Image>`.

```rust
fn configure_window(mut windows: Query<&mut Window>) {
    let Ok(mut window) = windows.single_mut() else {
        return;
    };
    window.resolution.set(720.0, 1280.0);
    window.resolution.set_scale_factor_override(Some(2.0));
}
```

```rust
#[derive(Resource, Default)]
struct LastTouch(Option<Vec2>);

fn track_touch(touches: Res<Touches>, mut last: ResMut<LastTouch>) {
    last.0 = touches.iter().next().map(|touch| touch.position());
}
```

```rust
#[derive(Component)]
struct TouchTarget;

#[derive(Component)]
struct HudRoot;

#[derive(Resource)]
struct SafeInsets {
    top: f32,
    bottom: f32,
}

fn enlarge_targets(mut nodes: Query<&mut Node, With<TouchTarget>>) {
    for mut node in &mut nodes {
        node.min_width = Val::Px(88.0);
        node.min_height = Val::Px(88.0);
    }
}

fn pad_hud(insets: Res<SafeInsets>, mut roots: Query<&mut Node, With<HudRoot>>) {
    for mut node in &mut roots {
        node.padding = UiRect {
            top: Val::Px(insets.top),
            bottom: Val::Px(insets.bottom),
            left: Val::Px(12.0),
            right: Val::Px(12.0),
        };
    }
}
```

```rust
use bevy::window::WindowScaleFactorChanged;

The rest: https://github.com/thedivergentai/Game-Dev-Agentic-Skills/blob/HEAD/skills/bevy-adapt-desktop-to-mobile/SKILL.md
