Skip to content

Commit

Permalink
Fix headless mode compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzm3r committed Nov 20, 2022
1 parent 8366e27 commit d410387
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
command: check
args: --all-targets --features atlas

- name: Run cargo check headless
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --no-default-features

# test:
# name: Tests
# strategy:
Expand Down
6 changes: 4 additions & 2 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ mod helpers;
fn startup(
mut commands: Commands,
asset_server: Res<AssetServer>,
#[cfg(not(feature = "atlas"))] array_texture_loader: Res<ArrayTextureLoader>,
#[cfg(all(not(feature = "atlas"), feature = "render"))] array_texture_loader: Res<
ArrayTextureLoader,
>,
) {
commands.spawn(Camera2dBundle::default());

Expand Down Expand Up @@ -60,7 +62,7 @@ fn startup(

// Add atlas to array texture loader so it's preprocessed before we need to use it.
// Only used when the atlas feature is off and we are using array textures.
#[cfg(not(feature = "atlas"))]
#[cfg(all(not(feature = "atlas"), feature = "render"))]
{
array_texture_loader.add(TilemapArrayTexture {
texture: TilemapTexture::Single(asset_server.load("tiles.png")),
Expand Down
3 changes: 0 additions & 3 deletions src/array_texture_preload.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[cfg(feature = "render")]
use crate::render::{DefaultSampler, TextureArrayCache};
use crate::{
prelude::{TilemapSpacing, TilemapTileSize},
Expand All @@ -8,7 +7,6 @@ use bevy::render::{
render_resource::{FilterMode, TextureFormat},
texture::BevyDefault,
};
#[cfg(feature = "render")]
use bevy::{
prelude::{Assets, Image, Res, ResMut, Resource},
render::Extract,
Expand Down Expand Up @@ -60,7 +58,6 @@ impl ArrayTextureLoader {
}
}

#[cfg(feature = "render")]
pub(crate) fn extract(
images: Extract<Res<Assets<Image>>>,
array_texture_loader: Extract<Res<ArrayTextureLoader>>,
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use tiles::{
use bevy::render::{RenderApp, RenderStage};

/// A module that allows pre-loading of atlases into array textures.
#[cfg(not(feature = "atlas"))]
#[cfg(all(not(feature = "atlas"), feature = "render"))]
mod array_texture_preload;
/// A module which provides helper functions.
pub mod helpers;
Expand Down Expand Up @@ -114,7 +114,7 @@ pub struct TilemapBundle {

/// A module which exports commonly used dependencies.
pub mod prelude {
#[cfg(not(feature = "atlas"))]
#[cfg(all(not(feature = "atlas"), feature = "render"))]
pub use crate::array_texture_preload::*;
pub use crate::helpers::filling::*;
pub use crate::helpers::geometry::*;
Expand Down

0 comments on commit d410387

Please sign in to comment.