Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Commit a0842a8

Browse files
authored
Merge pull request #42 from BillyDM/iced13
Iced 0.13
2 parents 4feacc0 + 79bc89a commit a0842a8

18 files changed

Lines changed: 1485 additions & 771 deletions

Cargo.toml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "iced_baseview"
3-
version = "0.0.3"
3+
version = "0.1.0"
44
authors = [
55
"Billy Messenger <BillyDM@protonmail.com>",
66
"Robbert van der Helm <mail@robbertvanderhelm.nl>",
@@ -15,24 +15,30 @@ keywords = ["gui", "ui", "graphics", "interface", "widgets"]
1515
categories = ["gui"]
1616

1717
[features]
18+
default = ["wgpu"]
1819
# Enables a debug view in native platforms (press F12)
1920
debug = ["iced_runtime/debug"]
2021
# Enable the wgu renderer
21-
wgpu = ["iced_renderer/wgpu"]
22-
image = ["iced_widget/image"]
23-
svg = ["iced_widget/svg"]
22+
wgpu = ["iced_renderer/wgpu", "iced_widget/wgpu"]
23+
image = ["iced_graphics/image", "iced_widget/image", "iced_renderer/image"]
24+
svg = ["iced_graphics/svg", "iced_widget/svg", "iced_renderer/svg"]
25+
geometry = ["iced_graphics/geometry", "iced_renderer/geometry"]
26+
web-colors = ["iced_graphics/web-colors", "iced_renderer/web-colors"]
2427
canvas = ["iced_widget/canvas"]
28+
system = ["dep:sysinfo"]
29+
trace = []
2530

2631
[dependencies]
27-
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "fdb43ea" }
32+
baseview = { git = "https://github.com/RustAudio/baseview.git", rev = "579130ecb4f9f315ae52190af42f0ea46aeaa4a2" }
2833
cfg-if = "1"
29-
copypasta = "0.8"
30-
iced_runtime = "0.1"
31-
iced_renderer = "0.1"
32-
iced_graphics = "0.9"
33-
iced_style = "0.9"
34-
iced_widget = "0.1"
34+
window_clipboard = "0.4.1"
35+
iced_runtime = "0.13"
36+
iced_renderer = "0.13"
37+
iced_graphics = "0.13"
38+
iced_widget = "0.13"
3539
keyboard-types = { version = "0.6", default-features = false }
3640
log = "0.4"
3741
raw-window-handle = "0.5"
42+
raw-window-handle-06 = { package = "raw-window-handle", version = "0.6" }
3843
thiserror = "1.0"
44+
sysinfo = { version = "0.30", optional = true }

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
[![Crates.io](https://img.shields.io/crates/v/iced_baseview.svg)](https://crates.io/crates/iced_baseview)
55
[![License](https://img.shields.io/crates/l/iced_baseview.svg)](https://github.com/BillyDM/iced_baseview/blob/main/LICENSE)
66

7-
A [`baseview`] backend for the [`Iced`] GUI library.
7+
A [baseview] backend for the [Iced] GUI library
88

99
<div align="center">
1010
<img src="screenshot.png">
1111
</div>
1212

1313
The [main branch](https://github.com/BillyDM/iced_baseview/tree/main) of this repository tracks the latest crates.io release of iced, while [iced_git branch](https://github.com/BillyDM/iced_baseview/tree/iced_git) tracks its git repository.
1414

15-
## VST / LV2 / AU Plugins
15+
## VST3 / CLAP / AU Plugins
1616

1717
Examples of how to use this library for audio plugins can be found here:
18-
* [`iced-baseplug-examples`]
18+
* [nih_plug_iced](https://github.com/robbert-vdh/nih-plug/tree/master/nih_plug_iced)
19+
* [iced-baseplug-examples](https://github.com/BillyDM/iced-baseplug-examples)
1920

20-
[`Iced`]: https://github.com/hecrj/iced
21-
[`baseview`]: https://github.com/RustAudio/baseview
22-
[`iced-baseplug-examples`]: https://github.com/BillyDM/iced-baseplug-examples
21+
[Iced]: https://github.com/hecrj/iced
22+
[baseview]: https://github.com/RustAudio/baseview

examples/counter.rs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
use iced_baseview::{
2+
baseview::{Size, WindowOpenOptions, WindowScalePolicy},
3+
settings::IcedBaseviewSettings,
4+
widget::{button, column, text},
5+
Application, Center, Element, Renderer, Settings, Task, Theme,
6+
};
7+
8+
fn main() {
9+
let settings = Settings {
10+
window: WindowOpenOptions {
11+
title: String::from("iced_baseview counter demo"),
12+
size: Size::new(500.0, 300.0),
13+
scale: WindowScalePolicy::SystemScaleFactor,
14+
},
15+
graphics_settings: iced_graphics::Settings {
16+
..Default::default()
17+
},
18+
iced_baseview: IcedBaseviewSettings {
19+
..Default::default()
20+
},
21+
..Default::default()
22+
};
23+
24+
iced_baseview::open_blocking::<MyProgram>(Flags::default(), settings);
25+
}
26+
27+
#[derive(Default)]
28+
struct Flags {
29+
initial_value: i64,
30+
}
31+
32+
#[derive(Debug, Clone, Copy)]
33+
enum Message {
34+
Increment,
35+
Decrement,
36+
}
37+
38+
struct MyProgram {
39+
value: i64,
40+
}
41+
42+
impl Application for MyProgram {
43+
type Message = Message;
44+
type Flags = Flags;
45+
type Theme = Theme;
46+
type Executor = iced_baseview::executor::Default;
47+
48+
fn new(flags: Flags) -> (Self, Task<Self::Message>) {
49+
(
50+
Self {
51+
value: flags.initial_value,
52+
},
53+
Task::none(),
54+
)
55+
}
56+
57+
fn update(&mut self, message: Self::Message) -> Task<Self::Message> {
58+
match message {
59+
Message::Increment => {
60+
self.value += 1;
61+
}
62+
Message::Decrement => {
63+
self.value -= 1;
64+
}
65+
}
66+
67+
dbg!(self.value);
68+
69+
Task::none()
70+
}
71+
72+
fn view(&self) -> Element<'_, Self::Message, Self::Theme, Renderer> {
73+
column![
74+
button("Increment").on_press(Message::Increment),
75+
text(self.value).size(50),
76+
button("Decrement").on_press(Message::Decrement)
77+
]
78+
.padding(20)
79+
.align_x(Center)
80+
.into()
81+
}
82+
83+
fn theme(&self) -> Self::Theme {
84+
Theme::Dark
85+
}
86+
}

examples/custom_styles.rs

Lines changed: 0 additions & 129 deletions
This file was deleted.

examples/hello_world.rs

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
use iced_baseview::{
22
baseview::{Size, WindowOpenOptions, WindowScalePolicy},
3-
core::{Alignment, Element, Length},
4-
open_blocking,
5-
runtime::Command,
6-
settings::IcedBaseviewSettings,
7-
widget::Column,
8-
widget::Container,
9-
widget::Rule,
10-
widget::Text,
11-
Application, Settings,
3+
widget::{Column, Container, Rule, Text},
4+
Alignment, Application, Element, Length, Renderer, Settings, Task, Theme,
125
};
136

147
fn main() {
@@ -18,56 +11,47 @@ fn main() {
1811
size: Size::new(500.0, 300.0),
1912
scale: WindowScalePolicy::SystemScaleFactor,
2013
},
21-
iced_baseview: IcedBaseviewSettings {
22-
ignore_non_modifier_keys: false,
23-
always_redraw: true,
24-
},
25-
flags: (),
26-
fonts: Default::default(),
14+
..Default::default()
2715
};
2816

29-
open_blocking::<MyProgram>(settings);
17+
iced_baseview::open_blocking::<MyProgram>((), settings);
3018
}
3119

3220
struct MyProgram;
3321

3422
impl Application for MyProgram {
35-
type Executor = iced_baseview::executor::Default;
3623
type Message = ();
37-
type Theme = iced_baseview::style::Theme;
3824
type Flags = ();
25+
type Theme = Theme;
26+
type Executor = iced_baseview::executor::Default;
3927

40-
fn new(_flags: ()) -> (Self, Command<Self::Message>) {
41-
(Self {}, Command::none())
28+
fn new(_flags: ()) -> (Self, Task<Self::Message>) {
29+
(Self {}, Task::none())
4230
}
31+
4332
fn title(&self) -> String {
4433
"Hello World!".into()
4534
}
46-
fn update(&mut self, _message: Self::Message) -> Command<Self::Message> {
47-
Command::none()
35+
36+
fn update(&mut self, _message: Self::Message) -> Task<Self::Message> {
37+
Task::none()
4838
}
4939

50-
fn view(
51-
&self,
52-
) -> Element<'_, Self::Message, iced_baseview::widget::renderer::Renderer<Self::Theme>> {
40+
fn view(&self) -> Element<'_, Self::Message, Self::Theme, Renderer> {
5341
let content = Column::new()
5442
.width(Length::Fill)
55-
.align_items(Alignment::Center)
43+
.align_x(Alignment::Center)
5644
.push(Text::new("Hello World!"))
5745
.push(Rule::horizontal(10));
5846

5947
Container::new(content)
6048
.width(Length::Fill)
6149
.height(Length::Fill)
62-
.center_x()
63-
.center_y()
50+
.center(Length::Fill)
6451
.into()
6552
}
6653

67-
fn renderer_settings() -> iced_renderer::Settings {
68-
iced_renderer::Settings {
69-
antialiasing: Some(iced_graphics::Antialiasing::MSAAx4),
70-
..Default::default()
71-
}
54+
fn theme(&self) -> Self::Theme {
55+
Theme::Dark
7256
}
7357
}

0 commit comments

Comments
 (0)