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

Merge nannou_egui into this repo #854

Merged
merged 78 commits into from
May 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
7b614d4
Initial commit
AlexEne May 9, 2021
7231e4f
Don't require window_id
AlexEne May 9, 2021
9d71895
It works
AlexEne May 11, 2021
d7f86d7
use scene encoder
AlexEne May 11, 2021
b10ef76
simplify example
AlexEne May 11, 2021
ed89729
input works
AlexEne May 12, 2021
7ad92e8
simplified
AlexEne May 12, 2021
b50956b
Create README.md
AlexEne May 12, 2021
fd0e4fc
Create LICENSE
AlexEne May 12, 2021
727f338
Merge pull request #1 from AlexEne/add-license-1
AlexEne May 12, 2021
2e3b8b8
updated metadata
AlexEne May 12, 2021
206de15
Create LICENSE-APACHE
AlexEne May 12, 2021
9994671
Fixed license
AlexEne May 12, 2021
dbfac17
radius
AlexEne May 12, 2021
ffc4c97
example
AlexEne May 12, 2021
cfd966d
Update README.md
AlexEne May 12, 2021
4802254
Update README.md
AlexEne May 12, 2021
de761ea
Update README.md
AlexEne May 12, 2021
cbfadd3
simplify API
AlexEne May 12, 2021
4284fb2
bump version
AlexEne May 12, 2021
94e8296
fix build
AlexEne May 12, 2021
0301523
fixed msaa
AlexEne May 12, 2021
eb79d3d
added readme
AlexEne May 12, 2021
4d229aa
small bump for readme
AlexEne May 12, 2021
6bdd6de
add readme
AlexEne May 12, 2021
e845abd
Update README.md
AlexEne May 12, 2021
cb6c737
color helper and fixed resizing
AlexEne May 12, 2021
3b7e493
bump version
AlexEne May 12, 2021
6dcc0b2
simplified project structure
AlexEne May 15, 2021
5c400e3
allow numbers and fix colror editor
AlexEne May 15, 2021
7e9331d
bump to 0.3.1
AlexEne May 15, 2021
d79939e
readme can be found
AlexEne May 15, 2021
933870d
Update dependencies to most recent version, fixes MSAA limitation
mitchmindtree Jul 10, 2021
55c7893
Create a workspace. Add crate with the official demonstration app.
mitchmindtree Jul 10, 2021
8a7b6b6
Refactor `nannou_egui` and add some basic docs
mitchmindtree Jul 10, 2021
e2bf49f
Add missing key conversion. Fix tracking of keyboard modifier keys.
mitchmindtree Jul 14, 2021
d0eba64
Merge pull request #5 from mitchmindtree/update-deps
AlexEne Jul 14, 2021
cf62ec9
Merge pull request #6 from mitchmindtree/workspace-demo-app
AlexEne Jul 14, 2021
414f6e3
Merge pull request #8 from mitchmindtree/refactor
AlexEne Jul 14, 2021
c3c6322
Merge pull request #9 from mitchmindtree/fix-keyboard-input
AlexEne Jul 14, 2021
222f2c6
bump version
AlexEne Jul 14, 2021
48867d0
Merge pull request #10 from AlexEne/bump-0.4
AlexEne Jul 14, 2021
a1d9ba3
bump correctly
AlexEne Jul 14, 2021
df1c43a
readme correct path
AlexEne Jul 14, 2021
c2a3cc9
msaa is no longer an issue
AlexEne Jul 14, 2021
2089441
Merge pull request #11 from AlexEne/bump-0.4
AlexEne Jul 14, 2021
deded35
media
AlexEne Jul 14, 2021
aa751f9
Update README.md
AlexEne Jul 14, 2021
efe8d26
Update README.md
AlexEne Jul 14, 2021
28c6768
Add some basic CI testing using github actions
mitchmindtree Jul 10, 2021
8296bb4
Run cargo fmt on repo to satisfy new CI check
mitchmindtree Jul 14, 2021
327e3f4
Add some pretty badges for docs, license and github CI status
mitchmindtree Jul 14, 2021
97d005a
Add missing system deps for linux to CI
mitchmindtree Jul 14, 2021
e59b892
Merge pull request #7 from mitchmindtree/ci
mitchmindtree Jul 14, 2021
5a84826
Fix bug where `Text` events would not emit non-alphanumeric chars
mitchmindtree Aug 13, 2021
a3107e5
Merge pull request #12 from mitchmindtree/fix-text-events
mitchmindtree Aug 16, 2021
0312124
Publish 0.4.1 with fix for text input events
mitchmindtree Aug 16, 2021
b7cb409
Merge pull request #13 from mitchmindtree/publish-0.4.1
AlexEne Aug 16, 2021
ff79dc2
Update to wgpu 0.10, egui 0.14
mitchmindtree Oct 5, 2021
e694a5c
Update to nannou 0.18.1, wgpu 0.11, egui 0.15, egui_wgpu_backend 0.14
mitchmindtree Dec 17, 2021
3f5ae52
Merge pull request #14 from mitchmindtree/update-deps
mitchmindtree Dec 17, 2021
50e3f1b
Publish version 0.5.0
mitchmindtree Dec 17, 2021
1c40cae
Merge pull request #15 from mitchmindtree/publish-0.5
mitchmindtree Dec 17, 2021
7fbd6d3
enable access to create and update TextureIds
JoshuaBatty Jan 3, 2022
1a48f61
Merge pull request #16 from JoshuaBatty/textures
mitchmindtree Jan 5, 2022
3d6397f
Merge remote-tracking branch 'alexene-nannou_egui/main' into merge-na…
mitchmindtree May 15, 2022
2f63fcd
Merge nannou_egui ci into main nannou ci
mitchmindtree May 15, 2022
fb7a760
Ensure nannou_egui and its app are synced to the local nannou
mitchmindtree May 15, 2022
ef79cde
Add basic README for nannou_egui_demo_app crate
mitchmindtree May 15, 2022
a58035c
Add nannou_egui to crate table in top-level README
mitchmindtree May 15, 2022
dc7878e
Simplify OSC examples to not require conrod for drawing text
mitchmindtree May 15, 2022
6b575eb
Replace conrod usage in laser_frame_stream_gui example with egui
mitchmindtree May 15, 2022
13bca2b
Move edit_color fn from nannou_egui into example
mitchmindtree May 15, 2022
1c548d9
Run cargo fmt on repo
mitchmindtree May 15, 2022
c85c1b1
Remove unnecessary licenses leftover after merge
mitchmindtree May 15, 2022
7516329
Remove accidentally included hidden vscode directory
mitchmindtree May 15, 2022
80d0233
Add mitchmindtree to nannou_egui authors table
mitchmindtree May 15, 2022
1d04e50
Move egui examples into main examples directory
mitchmindtree May 15, 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
3 changes: 3 additions & 0 deletions .github/workflows/nannou.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ jobs:
- name: Cargo publish nannou_conrod
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_conrod/Cargo.toml
- name: Cargo publish nannou_egui
continue-on-error: true
run: cargo publish --token $CRATESIO_TOKEN --manifest-path nannou_egui/Cargo.toml

guide-build-book:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ members = [
"nannou_audio",
"nannou_conrod",
"nannou_core",
"nannou_egui",
"nannou_egui_demo_app",
"nannou_isf",
"nannou_laser",
"nannou_mesh",
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The following nannou **libraries** are included within this repository.
| [**`nannou_audio`**](./nannou_audio) | [![Crates.io](https://img.shields.io/crates/v/nannou_audio.svg)](https://crates.io/crates/nannou_audio) [![docs.rs](https://docs.rs/nannou_audio/badge.svg)](https://docs.rs/nannou_audio/) | Audio hosts, devices and streams. |
| [**`nannou_conrod`**](./nannou_conrod) | [![Crates.io](https://img.shields.io/crates/v/nannou_conrod.svg)](https://crates.io/crates/nannou_conrod) [![docs.rs](https://docs.rs/nannou_conrod/badge.svg)](https://docs.rs/nannou_conrod/) | For creating conrod UIs in nannou apps. |
| [**`nannou_core`**](./nannou_core) | [![Crates.io](https://img.shields.io/crates/v/nannou_core.svg)](https://crates.io/crates/nannou_core) [![docs.rs](https://docs.rs/nannou_core/badge.svg)](https://docs.rs/nannou_core/) | Just-the-core for headless, embedded and libraries. |
| [**`nannou_egui`**](./nannou_egui) | [![Crates.io](https://img.shields.io/crates/v/nannou_egui.svg)](https://crates.io/crates/nannou_egui) [![docs.rs](https://docs.rs/nannou_egui/badge.svg)](https://docs.rs/nannou_egui/) | For creating egui UIs in nannou apps. |
| [**`nannou_isf`**](./nannou_isf) | [![Crates.io](https://img.shields.io/crates/v/nannou_isf.svg)](https://crates.io/crates/nannou_isf) [![docs.rs](https://docs.rs/nannou_isf/badge.svg)](https://docs.rs/nannou_isf/) | An Interactive Shader Format pipeline. |
| [**`nannou_laser`**](./nannou_laser) | [![Crates.io](https://img.shields.io/crates/v/nannou_laser.svg)](https://crates.io/crates/nannou_laser) [![docs.rs](https://docs.rs/nannou_laser/badge.svg)](https://docs.rs/nannou_laser/) | LASER devices, streams and path optimisation. |
| [**`nannou_mesh`**](./nannou_mesh) | [![Crates.io](https://img.shields.io/crates/v/nannou_mesh.svg)](https://crates.io/crates/nannou_mesh) [![docs.rs](https://docs.rs/nannou_mesh/badge.svg)](https://docs.rs/nannou_mesh/) | API for composing meshes from channels. |
Expand Down
7 changes: 7 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ hrtf = "0.2"
nannou = { version ="0.18.0", path = "../nannou" }
nannou_audio = { version ="0.18.0", path = "../nannou_audio" }
nannou_conrod = { version ="0.18.0", path = "../nannou_conrod" }
nannou_egui = { version = "0.5.0", path = "../nannou_egui" }
nannou_isf = { version = "0.1.0", path = "../nannou_isf" }
nannou_laser = { version ="0.18.0", features = ["ffi", "ilda-idtf"], path = "../nannou_laser" }
nannou_osc = { version ="0.18.0", path = "../nannou_osc" }
Expand Down Expand Up @@ -197,6 +198,12 @@ path = "ui/conrod/simple_ui.rs"
[[example]]
name = "timeline_demo"
path = "ui/conrod/timeline_demo.rs"
[[example]]
name = "circle_packing"
path = "ui/egui/circle_packing.rs"
[[example]]
name = "tune_color"
path = "ui/egui/tune_color.rs"

# WebGPU
[[example]]
Expand Down
42 changes: 14 additions & 28 deletions examples/communication/osc_receiver.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use nannou::prelude::*;
use nannou_conrod as ui;
use nannou_conrod::prelude::*;
use nannou_osc as osc;

fn main() {
Expand All @@ -10,19 +8,16 @@ fn main() {
struct Model {
receiver: osc::Receiver,
received_packets: Vec<(std::net::SocketAddr, osc::Packet)>,
ui: Ui,
text: widget::Id,
}

// Make sure this matches the `TARGET_PORT` in the `osc_sender.rs` example.
const PORT: u16 = 34254;

fn model(app: &App) -> Model {
let w_id = app
let _w_id = app
.new_window()
.title("OSC Receiver")
.size(1400, 480)
.raw_event(raw_window_event)
.view(view)
.build()
.unwrap();
Expand All @@ -33,22 +28,12 @@ fn model(app: &App) -> Model {
// A vec for collecting packets and their source address.
let received_packets = vec![];

// Create a simple UI to display received messages.
let mut ui = ui::builder(app).window(w_id).build().unwrap();
let text = ui.generate_widget_id();

Model {
receiver,
received_packets,
ui,
text,
}
}

fn raw_window_event(app: &App, model: &mut Model, event: &ui::RawWindowEvent) {
model.ui.handle_raw_event(app, event);
}

fn update(_app: &App, model: &mut Model, _update: Update) {
// Receive any pending osc packets.
for (packet, addr) in model.receiver.try_iter() {
Expand All @@ -60,24 +45,25 @@ fn update(_app: &App, model: &mut Model, _update: Update) {
while model.received_packets.len() > max_packets {
model.received_packets.remove(0);
}
}

// Draw the state of your `Model` into the given `Frame` here.
fn view(app: &App, model: &Model, frame: Frame) {
let draw = app.draw();
draw.background().color(DARKBLUE);

// Create a string showing all the packets.
let mut packets_text = format!("Listening on port {}\nReceived packets:\n", PORT);
for &(addr, ref packet) in model.received_packets.iter().rev() {
packets_text.push_str(&format!("{}: {:?}\n", addr, packet));
}

// Use the UI to display the packet string.
model.ui.clear_with(color::DARK_BLUE);
let mut ui = model.ui.set_widgets();
widget::Text::new(&packets_text)
.top_left_with_margin_on(ui.window, 20.0)
.color(color::WHITE)
let rect = frame.rect().pad(10.0);
draw.text(&packets_text)
.font_size(16)
.align_text_top()
.line_spacing(10.0)
.set(model.text, &mut ui);
}
.left_justify()
.wh(rect.wh());

// Draw the state of your `Model` into the given `Frame` here.
fn view(app: &App, model: &Model, frame: Frame) {
model.ui.draw_to_frame(app, &frame).unwrap();
draw.to_frame(app, &frame).unwrap();
}
38 changes: 11 additions & 27 deletions examples/communication/osc_sender.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
use nannou::prelude::*;
use nannou_conrod as ui;
use nannou_conrod::prelude::*;
use nannou_osc as osc;
use nannou_osc::Type;

fn main() {
nannou::app(model).update(update).run();
nannou::app(model).run();
}

struct Model {
sender: osc::Sender<osc::Connected>,
ui: Ui,
text: widget::Id,
}

// Make sure this matches `PORT` in the `osc_receiver.rs` example.
Expand All @@ -22,12 +18,11 @@ fn target_address_string() -> String {
}

fn model(app: &App) -> Model {
let w_id = app
let _w_id = app
.new_window()
.title("OSC Sender")
.size(680, 480)
.event(event)
.raw_event(raw_window_event)
.view(view)
.build()
.unwrap();
Expand All @@ -38,11 +33,7 @@ fn model(app: &App) -> Model {
// Bind an `osc::Sender` and connect it to the target address.
let sender = osc::sender().unwrap().connect(target_addr).unwrap();

// Create a simple UI to tell the user what to do.
let mut ui = ui::builder(app).window(w_id).build().unwrap();
let text = ui.generate_widget_id();

Model { sender, ui, text }
Model { sender }
}

fn event(_app: &App, model: &mut Model, event: WindowEvent) {
Expand Down Expand Up @@ -71,27 +62,20 @@ fn event(_app: &App, model: &mut Model, event: WindowEvent) {
}
}

fn raw_window_event(app: &App, model: &mut Model, event: &ui::RawWindowEvent) {
model.ui.handle_raw_event(app, event);
}
fn view(app: &App, _model: &Model, frame: Frame) {
let draw = app.draw();
draw.background().color(DARKRED);

fn update(_app: &App, model: &mut Model, _update: Update) {
// Use the UI to show the user where packets are being sent.
model.ui.clear_with(color::DARK_RED);
let mut ui = model.ui.set_widgets();
let text = format!(
"Move or click the mouse to send\nmessages to the \
receiver example!\n\nSending OSC packets to {}",
target_address_string()
);
widget::Text::new(&text)
.middle_of(ui.window)
.center_justify()
.color(color::WHITE)
let rect = frame.rect();
draw.text(&text)
.font_size(16)
.line_spacing(10.0)
.set(model.text, &mut ui);
}
.wh(rect.wh());

fn view(app: &App, model: &Model, frame: Frame) {
model.ui.draw_to_frame(app, &frame).unwrap();
draw.to_frame(app, &frame).unwrap();
}
Loading