Skip to content

Commit

Permalink
Fix feature flag use
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Nov 8, 2024
1 parent e616038 commit fc758a8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
27 changes: 20 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ immutable_ctx = []
manage_clipboard = ["arboard", "thread_local"]
open_url = ["webbrowser"]
default_fonts = ["egui/default_fonts"]
render = ["bevy_render"]
render = [
"bevy_render",
"bevy_asset",
"encase",
"bytemuck",
"egui/bytemuck",
"wgpu-types",
]
serde = ["egui/serde"]
# The enabled logs will print with the info log level, to make it less cumbersome to debug in browsers.
log_input_events = []
Expand Down Expand Up @@ -51,25 +58,31 @@ name = "render_egui_to_texture"
required-features = ["render"]

[dependencies]
egui = { version = "0.29", default-features = false }

bevy_app = "0.14"
bevy_asset = "0.14"
bevy_derive = "0.14"
bevy_ecs = "0.14"
bevy_input = "0.14"
bevy_log = "0.14"
bevy_math = "0.14"
bevy_render = { version = "0.14", optional = true }
bevy_reflect = "0.14"
bevy_time = "0.14"
bevy_utils = "0.14"
bevy_winit = "0.14"
bevy_window = "0.14"
encase = "0.8"
egui = { version = "0.29", default-features = false, features = ["bytemuck"] }
bytemuck = "1"

# `open_url` feature
webbrowser = { version = "1.0.1", optional = true }
wgpu-types = "0.20"

# `render` feature
bytemuck = { version = "1", optional = true }
bevy_asset = { version = "0.14", optional = true }
bevy_render = { version = "0.14", optional = true }
encase = { version = "0.8", optional = true }
wgpu-types = { version = "0.20", optional = true }

# `manage_clipboard` feature
[target.'cfg(not(any(target_arch = "wasm32", target_os = "android")))'.dependencies]
arboard = { version = "3.2.0", optional = true }
thread_local = { version = "1.1.0", optional = true }
Expand Down
16 changes: 5 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,19 @@ use crate::{
not(any(target_arch = "wasm32", target_os = "android"))
))]
use arboard::Clipboard;

#[cfg(feature = "render")]
use bevy_app::Last;
use bevy_asset::{load_internal_asset, AssetEvent, Assets, Handle};
use bevy_ecs::{event::EventReader, system::ResMut};
#[cfg(feature = "render")]
use bevy_render::{
extract_component::{ExtractComponent, ExtractComponentPlugin},
extract_resource::{ExtractResource, ExtractResourcePlugin},
render_resource::SpecializedRenderPipelines,
texture::{Image, ImageSampler},
ExtractSchedule, Render, RenderApp, RenderSet,
};
use bevy_utils::HashMap;

use bevy_app::{App, Plugin, PostUpdate, PreStartup, PreUpdate};
use bevy_app::prelude::*;
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::{
prelude::*,
Expand All @@ -114,14 +113,9 @@ use bevy_ecs::{
system::SystemParam,
};
use bevy_input::InputSystem;

use bevy_reflect::Reflect;
use bevy_window::{PrimaryWindow, Window};

#[cfg(feature = "render")]
use bevy_ecs::query::Or;
#[allow(unused_imports)]
use bevy_log;
#[cfg(all(
feature = "manage_clipboard",
not(any(target_arch = "wasm32", target_os = "android"))
Expand Down Expand Up @@ -561,7 +555,7 @@ pub struct EguiRenderToTextureHandle(pub Handle<Image>);
#[derive(Clone, bevy_ecs::system::Resource, Default, ExtractResource)]
#[cfg(feature = "render")]
pub struct EguiUserTextures {
textures: HashMap<Handle<Image>, u64>,
textures: bevy_utils::HashMap<Handle<Image>, u64>,
last_texture_id: u64,
}

Expand Down Expand Up @@ -900,7 +894,7 @@ impl EguiContextQueryItem<'_> {
/// Contains textures allocated and painted by Egui.
#[cfg(feature = "render")]
#[derive(bevy_ecs::system::Resource, Deref, DerefMut, Default)]
pub struct EguiManagedTextures(pub HashMap<(Entity, u64), EguiManagedTexture>);
pub struct EguiManagedTextures(pub bevy_utils::HashMap<(Entity, u64), EguiManagedTexture>);

/// Represents a texture allocated and painted by Egui.
#[cfg(feature = "render")]
Expand Down
1 change: 1 addition & 0 deletions src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use bevy_winit::{EventLoopProxy, WakeUp};

#[cfg(feature = "render")]
use bevy_asset::Assets;
#[cfg(feature = "render")]
use bevy_render::texture::Image;
use std::{marker::PhantomData, time::Duration};

Expand Down

0 comments on commit fc758a8

Please sign in to comment.