Skip to content

Commit

Permalink
fix: web builds and tidyness
Browse files Browse the repository at this point in the history
  • Loading branch information
eerii committed Aug 4, 2024
1 parent 749f5f1 commit d6c4fd1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ an opinionated [bevy](https://github.com/bevyengine/bevy) template for my projec

### runing locally 🌺

this project is configured to use dynamic linking for debug builds and fast recompiling by default.
in order to have the fastest compile, you may install [mold](https://github.com/rui314/mold) and use rust nightly (`rustup default nightly`).
if you don't want some of these features, go to [.cargo/config](.cargo/config) and follow the instructions, or remove it to disable optimizations all together.

to run a debug build use cargo:

```sh
Expand Down
8 changes: 4 additions & 4 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

use crate::prelude::*;

mod data;
mod later;
mod sets;
mod states;
pub mod data;
pub mod later;
pub mod sets;
pub mod states;

pub(super) fn plugin(app: &mut App) {
app.add_plugins((data::plugin, later::plugin, sets::plugin, states::plugin));
Expand Down
26 changes: 18 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Bevy game template.
//! It uses plugins and submodules to structure the code.

// TODO: Code examples

#![feature(path_add_extension)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
Expand Down Expand Up @@ -35,6 +33,17 @@ impl Plugin for GamePlugin {
app.add_plugins(assets::embedded::plugin);

// Default bevy plugins
let asset_plugin = AssetPlugin {
meta_check: bevy::asset::AssetMetaCheck::Never,
..default()
};

let image_plugin = if cfg!(feature = "pixel_perfect") {
ImagePlugin::default_nearest()
} else {
ImagePlugin::default()
};

let window_plugin = WindowPlugin {
primary_window: Some(Window {
title: "Hello Bevy".into(),
Expand All @@ -44,12 +53,13 @@ impl Plugin for GamePlugin {
}),
..default()
};
let image_plugin = if cfg!(feature = "pixel_perfect") {
ImagePlugin::default_nearest()
} else {
ImagePlugin::default()
};
app.add_plugins(DefaultPlugins.set(window_plugin).set(image_plugin));

app.add_plugins(
DefaultPlugins
.set(asset_plugin)
.set(image_plugin)
.set(window_plugin),
);

// Game plugins
app.add_plugins((
Expand Down
6 changes: 3 additions & 3 deletions src/ui/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

use crate::prelude::*;

mod main;
mod mappings;
mod options;
pub mod main;
pub mod mappings;
pub mod options;

pub(super) fn plugin(app: &mut App) {
app.add_sub_state::<MenuState>()
Expand Down

0 comments on commit d6c4fd1

Please sign in to comment.