Skip to content

Commit

Permalink
Make rendering resources public as well
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbat00 committed Nov 13, 2022
1 parent 180d489 commit 78b1338
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/egui_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ use bevy::{
window::WindowId,
};

/// Egui shader.
pub const EGUI_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 9898276442290979394);

/// Egui render pipeline.
#[derive(Resource)]
pub struct EguiPipeline {
/// Transform bind group layout.
pub transform_bind_group_layout: BindGroupLayout,
/// Texture bind group layout.
pub texture_bind_group_layout: BindGroupLayout,
}

Expand Down Expand Up @@ -84,8 +88,10 @@ impl FromWorld for EguiPipeline {
}
}

/// Key for specialized pipeline.
#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct EguiPipelineKey {
/// Texture format of a window's swap chain to render to.
pub texture_format: TextureFormat,
}

Expand Down Expand Up @@ -151,6 +157,7 @@ struct DrawCommand {
clipping_zone: (u32, u32, u32, u32), // x, y, w, h
}

/// Egui render node.
pub struct EguiNode {
window_id: WindowId,
vertex_data: Vec<u8>,
Expand All @@ -163,6 +170,7 @@ pub struct EguiNode {
}

impl EguiNode {
/// Constructs Egui render node.
pub fn new(window_id: WindowId) -> Self {
EguiNode {
window_id,
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
//!
//! - [`bevy-inspector-egui`](https://github.com/jakobhellermann/bevy-inspector-egui)
pub use egui;
/// Plugin systems for the render app.
pub mod render_systems;
/// Plugin systems.
pub mod systems;

mod egui_node;
/// Egui render node.
pub mod egui_node;

pub use egui;

use crate::{
egui_node::{EguiPipeline, EGUI_SHADER_HANDLE},
Expand Down
4 changes: 1 addition & 3 deletions src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ pub fn process_input_system(
}
egui::Key::V => {
if let Some(contents) = input_resources.egui_clipboard.get_contents() {
focused_input
.events
.push(egui::Event::Text(contents))
focused_input.events.push(egui::Event::Text(contents))
}
}
_ => {}
Expand Down

0 comments on commit 78b1338

Please sign in to comment.