Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Letronix624 authored Jul 25, 2024
2 parents d8a6a6c + 00bd40b commit e91d65b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ categories = ["gui", "game-development"]
keywords = ["gui", "imgui", "immediate", "portable", "gamedev"]

[features]
default = ["clipboard", "links"]
default = ["clipboard", "links", "wayland", "x11", "image"]
links = ["egui-winit/links"]
clipboard = ["egui-winit/clipboard"]
wayland = ["winit/wayland", "winit/wayland-dlopen", "egui-winit/wayland"]
x11 = ["winit/x11", "egui-winit/x11"]

[dependencies]
ahash = "0.8"
egui-winit = "0.28"
egui-winit = { version = "0.28", default-features = false }
egui = "0.28"
image = "0.25"
winit = { version = "0.29" }
image = { version = "0.25", optional = true }
winit = { version = "0.29", default-features = false }
vulkano = { version = "0.34", git = "https://github.com/vulkano-rs/vulkano.git"}
vulkano-shaders = "0.34"

Expand Down
5 changes: 4 additions & 1 deletion src/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ use vulkano::{
};
use winit::window::Window;

#[cfg(feature = "image")]
use crate::utils::immutable_texture_from_file;
use crate::{
renderer::{RenderResources, Renderer},
utils::{immutable_texture_from_bytes, immutable_texture_from_file},
utils::immutable_texture_from_bytes,
};

pub struct GuiConfig {
Expand Down Expand Up @@ -263,6 +265,7 @@ impl Gui {
/// Registers a user image to be used by egui
/// - `image_file_bytes`: e.g. include_bytes!("./assets/tree.png")
/// - `format`: e.g. vulkano::format::Format::R8G8B8A8Unorm
#[cfg(feature = "image")]
pub fn register_user_image(
&mut self,
image_file_bytes: &[u8],
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ mod utils;
pub use egui;
pub use integration::*;
pub use renderer::{CallbackContext, CallbackFn, RenderResources};
pub use utils::{immutable_texture_from_bytes, immutable_texture_from_file};
pub use utils::immutable_texture_from_bytes;
#[cfg(feature = "image")]
pub use utils::immutable_texture_from_file;
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use std::sync::Arc;

#[cfg(feature = "image")]
use image::RgbaImage;
use vulkano::{
buffer::{AllocateBufferError, Buffer, BufferCreateInfo, BufferUsage},
Expand Down Expand Up @@ -83,6 +84,7 @@ pub fn immutable_texture_from_bytes(
Ok(ImageView::new_default(texture).unwrap())
}

#[cfg(feature = "image")]
pub fn immutable_texture_from_file(
allocators: &Allocators,
queue: Arc<Queue>,
Expand Down

0 comments on commit e91d65b

Please sign in to comment.