Skip to content

Commit

Permalink
Clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
benfrankel committed Aug 15, 2024
1 parent 2c6a95a commit eba809e
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 40 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ The best way to get started is to play around with what you find in [`src/demo/`

This template comes with a basic project structure that you may find useful:

| Path | Description |
| -------------------------------------------------- | -------------------------------------------------------------------------- |
| [`src/lib.rs`](./src/lib.rs) | App setup |
| [`src/asset_tracking.rs`](./src/asset_tracking.rs) | A simple, high-level way to load collections of asset handles as resources |
| [`src/audio/`](./src/audio) | Commands for playing SFX and music |
| [`src/demo/`](./src/demo) | Example game mechanics & content (replace with your own code) |
| [`src/dev_tools.rs`](./src/dev_tools.rs) | Dev tools for dev builds (press \` aka backtick to toggle) |
| [`src/screens/`](./src/screens) | Splash screen, title screen, playing screen, etc. |
| [`src/theme/`](./src/theme) | Reusable UI widgets & theming
| Path | Description |
| -------------------------------------------------- | ------------------------------------------------------------------ |
| [`src/lib.rs`](./src/lib.rs) | App setup |
| [`src/asset_tracking.rs`](./src/asset_tracking.rs) | A high-level way to load collections of asset handles as resources |
| [`src/audio/`](./src/audio) | Commands for playing SFX and music |
| [`src/demo/`](./src/demo) | Example game mechanics & content (replace with your own code) |
| [`src/dev_tools.rs`](./src/dev_tools.rs) | Dev tools for dev builds (press \` aka backtick to toggle) |
| [`src/screens/`](./src/screens) | Splash screen, title screen, playing screen, etc. |
| [`src/theme/`](./src/theme) | Reusable UI widgets & theming |

Feel free to move things around however you want, though.

If you are new to Bevy, the patterns used in this template may look a bit weird at first glance.
If you're new to Bevy, the patterns used in this template may look a bit weird at first glance.
See our [Design Document](./docs/design.md) for more information on how we structured the code and why.

> [!Tip]
Expand Down
3 changes: 1 addition & 2 deletions src/asset_tracking.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A simple, high-level way to load collections of asset handles as resources
//! A high-level way to load collections of asset handles as resources.

use bevy::prelude::*;

Expand Down Expand Up @@ -38,7 +38,6 @@ type InsertLoadedResource = fn(&mut World, &UntypedHandle);
#[derive(Resource, Default)]
struct ResourceHandles {
waiting: Vec<(UntypedHandle, InsertLoadedResource)>,
#[allow(unused)]
finished: Vec<UntypedHandle>,
}

Expand Down
5 changes: 3 additions & 2 deletions src/demo/animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use bevy::prelude::*;
use rand::prelude::*;
use std::time::Duration;

use super::movement::MovementController;
use crate::{audio::SoundEffect, demo::player::PlayerAssets, AppSet};
use crate::{
audio::SoundEffect, demo::movement::MovementController, demo::player::PlayerAssets, AppSet,
};

pub(super) fn plugin(app: &mut App) {
// Animate and play sound effects based on controls.
Expand Down
2 changes: 1 addition & 1 deletion src/demo/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use bevy::{ecs::world::Command, prelude::*};

use super::player::SpawnPlayer;
use crate::demo::player::SpawnPlayer;

pub(super) fn plugin(_app: &mut App) {
// No setup required for this plugin.
Expand Down
3 changes: 1 addition & 2 deletions src/screens/credits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use bevy::prelude::*;

use super::Screen;
use crate::{asset_tracking::LoadResource, audio::Music, theme::prelude::*};
use crate::{asset_tracking::LoadResource, audio::Music, screens::Screen, theme::prelude::*};

pub(super) fn plugin(app: &mut App) {
app.load_resource::<CreditsMusic>();
Expand Down
3 changes: 1 addition & 2 deletions src/screens/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

use bevy::prelude::*;

use super::Screen;
use crate::{
demo::player::PlayerAssets,
screens::{credits::CreditsMusic, playing::GameplayMusic},
screens::{credits::CreditsMusic, playing::GameplayMusic, Screen},
theme::{interaction::InteractionAssets, prelude::*},
};

Expand Down
2 changes: 1 addition & 1 deletion src/screens/playing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use bevy::{input::common_conditions::input_just_pressed, prelude::*};

use super::Screen;
use crate::{
asset_tracking::LoadResource, audio::Music, demo::level::spawn_level as spawn_level_command,
screens::Screen,
};

pub(super) fn plugin(app: &mut App) {
Expand Down
3 changes: 1 addition & 2 deletions src/screens/splash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use bevy::{
render::texture::{ImageLoaderSettings, ImageSampler},
};

use super::Screen;
use crate::{theme::prelude::*, AppSet};
use crate::{screens::Screen, theme::prelude::*, AppSet};

pub(super) fn plugin(app: &mut App) {
// Spawn splash screen.
Expand Down
3 changes: 1 addition & 2 deletions src/screens/title.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use bevy::prelude::*;

use super::Screen;
use crate::theme::prelude::*;
use crate::{screens::Screen, theme::prelude::*};

pub(super) fn plugin(app: &mut App) {
app.add_systems(OnEnter(Screen::Title), show_title_screen);
Expand Down
7 changes: 2 additions & 5 deletions src/theme/interaction.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use bevy::prelude::*;

use crate::{asset_tracking::LoadResource, audio::SoundEffect};
use bevy::{
ecs::{system::SystemId, world::Command},
prelude::*,
};
use std::{collections::VecDeque, marker::PhantomData};

pub(super) fn plugin(app: &mut App) {
app.register_type::<InteractionPalette>();
Expand Down
5 changes: 3 additions & 2 deletions src/theme/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//! Reusable UI widgets & theming.

// Unused utilities and re-exports may trigger these lints undesirably.
#![allow(dead_code, unused_imports)]
// Unused utilities may trigger this lints undesirably.
#![allow(dead_code)]

pub mod interaction;
pub mod palette;
mod widgets;

#[allow(unused_imports)]
pub mod prelude {
pub use super::{
interaction::{InteractionPalette, OnPress},
Expand Down
11 changes: 2 additions & 9 deletions src/theme/widgets.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
//! Helper traits for creating common widgets.

use bevy::{
ecs::system::{EntityCommands, SystemId},
prelude::*,
ui::Val::*,
};
use bevy::{ecs::system::EntityCommands, prelude::*, ui::Val::*};

use super::{
interaction::{InteractionPalette, OnPress},
palette::*,
};
use crate::theme::{interaction::InteractionPalette, palette::*};

/// An extension trait for spawning UI widgets.
pub trait Widgets {
Expand Down

0 comments on commit eba809e

Please sign in to comment.