Skip to content

Commit 3ad88bc

Browse files
committed
docs: add documentation to mobile example and fix missing_docs warning
- Added documentation to the mobile example's main entry point - Fixed missing_docs warning by adding an expect attribute to the MainPlugin struct
1 parent 3648342 commit 3ad88bc

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

examples/mobile/src/lib.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,26 @@ fn main() {
4343
.run();
4444
}
4545

46+
#[expect(
47+
missing_docs,
48+
reason = "This is a simple marker struct and does not require documentation."
49+
)]
4650
pub struct MainPlugin;
4751

4852
impl Plugin for MainPlugin {
4953
fn build(&self, app: &mut App) {
50-
app
51-
.insert_resource(WinitSettings::mobile())
52-
.add_systems(Startup, (setup_scene, setup_music))
53-
.add_systems(
54-
Update,
55-
(
56-
touch_camera,
57-
button_handler,
58-
// Only run the lifetime handler when an [`AudioSink`] component exists in the world.
59-
// This ensures we don't try to manage audio that hasn't been initialized yet.
60-
handle_lifetime.run_if(any_with_component::<AudioSink>),
61-
),
62-
);
54+
app.insert_resource(WinitSettings::mobile())
55+
.add_systems(Startup, (setup_scene, setup_music))
56+
.add_systems(
57+
Update,
58+
(
59+
touch_camera,
60+
button_handler,
61+
// Only run the lifetime handler when an [`AudioSink`] component exists in the world.
62+
// This ensures we don't try to manage audio that hasn't been initialized yet.
63+
handle_lifetime.run_if(any_with_component::<AudioSink>),
64+
),
65+
);
6366
}
6467
}
6568

@@ -209,4 +212,3 @@ fn handle_lifetime(
209212
}
210213
}
211214
}
212-

examples/mobile/src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//! # Mobile Example (Desktop Entry Point)
2+
//!
3+
//! This is the desktop entry point for a Bevy application designed to simulate
4+
//! a mobile environment. It runs on a PC but uses a mobile-like window resolution
5+
//! (360x640) for development and testing purposes.
6+
//!
7+
//! ## Features:
8+
//! - Uses `DefaultPlugins` with a custom `AssetPlugin` to load assets from a specific directory.
9+
//! - Configures the primary window to start in a 360x640 resolution (portrait mode).
10+
//! - Implements a system to toggle the window orientation between portrait and landscape using the keyboard.
11+
//!
12+
//! ## Controls:
13+
//! - Press `L` to switch to landscape mode (640x360).
14+
//! - Press `P` to switch back to portrait mode (360x640).
15+
116
use bevy::prelude::*;
217
use bevy::window::{PrimaryWindow, WindowResolution};
318

0 commit comments

Comments
 (0)