
Bevy Adapt Mobile To Desktop
Bevy ECS skill for adapting a Bevy mobile game to desktop.
Install
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-adapt-mobile-to-desktop -g -a claude-code -y- Repository
- thedivergentai/Game-Dev-Agentic-Skills917
- Category
- Engineering
- Updated
- 19d ago
- License
- LGPL-3.0
- Context cost
- Mediumabout 2,116 tokens
- Runs scripts
- No, instructions only
What it does
Bevy ECS skill for adapting a Bevy mobile game to desktop. Keywords: Bevy, desktop, mouse, keyboard, adapt, window.
Bevy adapt mobile to desktop
When to use
Load this when a touch-first game gains a window, mouse, and keyboard. Window setup is bevy-platform-desktop.
ECS shape
- Window:
Window,WindowMode, andPrimaryWindow. - Input: keyboard, mouse, and gamepad features are named on the crate page and already used by bevy-input-handling.
- Pointer:
CursorOptionson the primary window.CursorGrabMode::None,Confined, orLocked.
Desktop choices
| Need | Bevy idiom |
|---|---|
| On-screen buttons | Keyboard and mouse via bevy-input-handling, writing the same intent component. |
| Wider layout | A wider WindowResolution on the primary Window. |
| Pointer lock | CursorOptions.grab_mode = CursorGrabMode::Locked and visible = false. |
Scope
- Keyboard and mouse write a
MoveIntentcomponent. Touch buttons can keep writing that same component. - Window mode, resolution, present mode, and cursor grab live on the primary window entity.
Examples
[package]
name = "desktop_port"
version = "0.1.0"
edition = "2021"
[dependencies]
bevy = "0.20"
Open a windowed 1920x1080 view and lock the pointer while aiming.
use bevy::window::{
CursorGrabMode, CursorOptions, MonitorSelection, PresentMode, PrimaryWindow, WindowMode,
WindowResolution,
};
fn desktop_window(mut windows: Query<&mut Window, With<PrimaryWindow>>) {
for mut window in &mut windows {
window.mode = WindowMode::Windowed;
window.resolution = WindowResolution::new(1920, 1080);
window.title = "Desktop".to_string();
window.present_mode = PresentMode::AutoVsync;
}
}
fn unlock_framerate(mut windows: Query<&mut Window, With<PrimaryWindow>>) {
for mut window in &mut windows {
window.present_mode = PresentMode::AutoNoVsync;
}
}
