Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop events on focus #50

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0e2eba4
Bump to 0.8.0
vladbat00 Nov 27, 2021
cfd79a2
track bevy main branch
jakobhellermann May 9, 2021
26504e7
bump winit version to match bevy main
aevyrie May 19, 2021
5e3d52b
update bevy: wgpu 0.8
jakobhellermann May 9, 2021
8a21c84
update bevy: bytemuck
jakobhellermann May 18, 2021
bc846dd
remove AppBuilder
jakobhellermann Jul 29, 2021
81af0da
fix lifetimes
jakobhellermann Sep 5, 2021
8cdbdf1
update to pipelined bevy rendering
jakobhellermann Jul 15, 2021
a196fac
use raw wgpu render pipeline
jakobhellermann Oct 29, 2021
5a0890c
remove bevy_wgpu from features
jakobhellermann Nov 26, 2021
f720a86
remove glsl shaders
jakobhellermann Nov 26, 2021
b43e0a8
small refactor
jakobhellermann Nov 26, 2021
3251dc1
queue bind groups in RenderStage::Queue
jakobhellermann Nov 26, 2021
13f26da
Refactor WGSL vector casts (remove vec3_bool_to_f32)
vladbat00 Dec 5, 2021
a6c80b8
Avoid re-creating vertex and index buffers each frame
vladbat00 Dec 5, 2021
05f6358
update winit
jakobhellermann Dec 11, 2021
bf527ff
pipelined merged into main
jakobhellermann Dec 14, 2021
a3818f3
cargo fmt
jakobhellermann Dec 14, 2021
8e94ddb
remove 'tracing 0.2.0' workaround
jakobhellermann Dec 14, 2021
a08135f
disable two windows example
jakobhellermann Dec 14, 2021
bab06b3
Update wgpu
TheRawMeatball Dec 19, 2021
636ee31
fix sub app mutability
jakobhellermann Dec 24, 2021
53c1773
Drop input events if the pointer is focused over any egui windows.
rezural Jan 5, 2022
f7fe170
depend on rezural/bevy#input-derive-clone
rezural Jan 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ jobs:
restore-keys: |
cache-wasm32-cargo-${{ hashFiles('**/Cargo.toml') }}
cache-wasm32-cargo
- uses: actions-rs/cargo@v1
with:
command: update
args: -p tracing-wasm --precise 0.2.0
- uses: actions-rs/cargo@v1
with:
command: clippy
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.0] - 27-Nov-2021

### Added

- Upgrade Egui to 0.15.0 ([#45](https://github.com/mvlabat/bevy_egui/pull/45)).

## [0.7.1] - 06-Oct-2021

### Added
Expand Down
24 changes: 15 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_egui"
version = "0.7.1"
version = "0.8.0"
authors = ["mvlabat <[email protected]>"]
description = "A plugin for Egui integration into Bevy"
license = "MIT"
Expand All @@ -17,15 +17,19 @@ no-default-features = true # clipboard crate fails the build currently https://g
default = ["manage_clipboard", "open_url"]
manage_clipboard = ["clipboard", "thread_local"]
open_url = ["webbrowser"]
drop_events_on_focus = []

[dependencies]
bevy = { version = "0.5", default-features = false, features = [
"render",
"bevy_winit"
bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = [
"bevy_render",
"bevy_winit",
"bevy_core_pipeline"
] }
egui = "0.15.0"
webbrowser = { version = "0.5.5", optional = true }
winit = { version = "0.24.0", features = ["x11"], default-features = false }
winit = { version = "0.26.0", features = ["x11"], default-features = false }
bytemuck = { version = "1.7.0", features = ["derive"] }
wgpu = "0.12.0"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
clipboard = { version = "0.5.0", optional = true }
Expand All @@ -35,8 +39,10 @@ thread_local = { version = "1.1.0", optional = true }
version-sync = "0.9.2"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
bevy = { version = "0.5", default-features = false, features = [
"bevy_wgpu",
"x11",
"png"
bevy = { git = "https://github.com/bevyengine/bevy", branch = "main", default-features = false, features = [
"x11",
"png"
] }

[patch."https://github.com/bevyengine/bevy"]
bevy = { git = "https://github.com/rezural/bevy", branch = "input-derive-clone" }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Here's a minimal usage example:
# Cargo.toml
[dependencies]
bevy = "0.5"
bevy_egui = "0.7"
bevy_egui = "0.8"
```

```rust
Expand Down Expand Up @@ -78,5 +78,5 @@ cargo run --example ui

|bevy|bevy_egui|
|---|---|
|0.5|0.4-0.7|
|0.5|0.4-0.8|
|0.4|0.1-0.3|
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy::prelude::*;
use bevy_egui::{egui, EguiContext, EguiPlugin};

fn main() {
App::build()
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(EguiPlugin)
.add_system(ui_example.system())
Expand Down
13 changes: 8 additions & 5 deletions examples/two_windows.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
fn main() {}
/*
use bevy::{
prelude::*,
render::{
Expand All @@ -17,7 +19,7 @@ const BEVY_TEXTURE_ID: u64 = 0;

/// This example creates a second window and draws a mesh from two different cameras.
fn main() {
App::build()
App::new()
.insert_resource(Msaa { samples: 4 })
.init_resource::<SharedUiState>()
.add_state(AppState::CreateWindow)
Expand Down Expand Up @@ -117,15 +119,15 @@ fn setup_pipeline(

// add a new render pass for our new window / camera
let mut second_window_pass = PassNode::<&MainPass>::new(PassDescriptor {
color_attachments: vec![msaa.color_attachment_descriptor(
color_attachments: vec![msaa.color_attachment(
TextureAttachment::Input("color_attachment".to_string()),
TextureAttachment::Input("color_resolve_target".to_string()),
Operations {
load: LoadOp::Clear(Color::rgb(0.5, 0.5, 0.8)),
store: true,
},
)],
depth_stencil_attachment: Some(RenderPassDepthStencilAttachmentDescriptor {
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
attachment: TextureAttachment::Input("depth".to_string()),
depth_ops: Some(Operations {
load: LoadOp::Clear(1.0),
Expand Down Expand Up @@ -174,7 +176,7 @@ fn setup_pipeline(
window_id,
TextureDescriptor {
size: Extent3d {
depth: 1,
depth_or_array_layers: 1,
width: 1,
height: 1,
},
Expand Down Expand Up @@ -241,7 +243,7 @@ fn setup(
..Default::default()
});
// light
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_xyz(4.0, 5.0, 4.0),
..Default::default()
});
Expand Down Expand Up @@ -325,3 +327,4 @@ fn ui_second_window(
},
);
}
*/
2 changes: 1 addition & 1 deletion examples/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BEVY_TEXTURE_ID: u64 = 0;
/// - toggling hidpi scaling (by pressing '/' button);
/// - configuring egui contexts during the startup.
fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.0)))
.insert_resource(Msaa { samples: 4 })
.init_resource::<UiState>()
Expand Down
21 changes: 0 additions & 21 deletions src/egui.es.frag

This file was deleted.

32 changes: 0 additions & 32 deletions src/egui.es.vert

This file was deleted.

15 changes: 0 additions & 15 deletions src/egui.frag

This file was deleted.

30 changes: 0 additions & 30 deletions src/egui.vert

This file was deleted.

49 changes: 49 additions & 0 deletions src/egui.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
struct EguiTransform {
scale: vec2<f32>;
translation: vec2<f32>;
};

[[group(0), binding(0)]]
var<uniform> egui_transform: EguiTransform;

struct VertexOutput {
[[location(0)]] uv: vec2<f32>;
[[location(1)]] color: vec4<f32>;
[[builtin(position)]] pos: vec4<f32>;
};

fn linear_from_srgb(srgb: vec3<f32>) -> vec3<f32> {
let cutoff = vec3<f32>(srgb < vec3<f32>(10.31475));
let lower = srgb / vec3<f32>(3294.6);
let higher = pow((srgb + vec3<f32>(14.025)) / vec3<f32>(269.025), vec3<f32>(2.4));
return mix(higher, lower, cutoff);
}

fn linear_from_srgba(srgba: vec4<f32>) -> vec4<f32> {
return vec4<f32>(linear_from_srgb(srgba.rgb), srgba.a / 255.0);
}

[[stage(vertex)]]
fn vs_main(
[[location(0)]] position: vec2<f32>,
[[location(1)]] uv: vec2<f32>,
[[location(2)]] color: vec4<f32>,
) -> VertexOutput {
var out: VertexOutput;
out.uv = uv;
out.color = linear_from_srgba(color);
out.pos = vec4<f32>(position * egui_transform.scale + egui_transform.translation, 0.0, 1.0);
return out;
}

[[group(1), binding(0)]]
var t_egui: texture_2d<f32>;
[[group(1), binding(1)]]
var s_egui: sampler;

[[stage(fragment)]]
fn fs_main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
let color = in.color * textureSample(t_egui, s_egui, in.uv);

return color;
}
Loading