summaryrefslogtreecommitdiffstats
path: root/examples/integration_wgpu/src/controls.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-06 23:29:38 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-02-24 13:17:58 +0100
commitb9a9576207ddfc7afd89da30b7cfc7ca0d7e335c (patch)
treec0b4489f1e547fc335e6b82025891cefdc671274 /examples/integration_wgpu/src/controls.rs
parent573d27eb52bbfacf1b06983b4282f00eb5265bdc (diff)
downloadiced-b9a9576207ddfc7afd89da30b7cfc7ca0d7e335c.tar.gz
iced-b9a9576207ddfc7afd89da30b7cfc7ca0d7e335c.tar.bz2
iced-b9a9576207ddfc7afd89da30b7cfc7ca0d7e335c.zip
Remove `iced_glow`, `glyph-brush`, and `wgpu_glyph` dependencies
Diffstat (limited to 'examples/integration_wgpu/src/controls.rs')
-rw-r--r--examples/integration_wgpu/src/controls.rs112
1 files changed, 0 insertions, 112 deletions
diff --git a/examples/integration_wgpu/src/controls.rs b/examples/integration_wgpu/src/controls.rs
deleted file mode 100644
index 533cb6e2..00000000
--- a/examples/integration_wgpu/src/controls.rs
+++ /dev/null
@@ -1,112 +0,0 @@
-use iced_wgpu::Renderer;
-use iced_winit::widget::{slider, text_input, Column, Row, Text};
-use iced_winit::{Alignment, Color, Command, Element, Length, Program};
-
-pub struct Controls {
- background_color: Color,
- text: String,
-}
-
-#[derive(Debug, Clone)]
-pub enum Message {
- BackgroundColorChanged(Color),
- TextChanged(String),
-}
-
-impl Controls {
- pub fn new() -> Controls {
- Controls {
- background_color: Color::BLACK,
- text: Default::default(),
- }
- }
-
- pub fn background_color(&self) -> Color {
- self.background_color
- }
-}
-
-impl Program for Controls {
- type Renderer = Renderer;
- type Message = Message;
-
- fn update(&mut self, message: Message) -> Command<Message> {
- match message {
- Message::BackgroundColorChanged(color) => {
- self.background_color = color;
- }
- Message::TextChanged(text) => {
- self.text = text;
- }
- }
-
- Command::none()
- }
-
- fn view(&self) -> Element<Message, Renderer> {
- let background_color = self.background_color;
- let text = &self.text;
-
- let sliders = Row::new()
- .width(500)
- .spacing(20)
- .push(
- slider(0.0..=1.0, background_color.r, move |r| {
- Message::BackgroundColorChanged(Color {
- r,
- ..background_color
- })
- })
- .step(0.01),
- )
- .push(
- slider(0.0..=1.0, background_color.g, move |g| {
- Message::BackgroundColorChanged(Color {
- g,
- ..background_color
- })
- })
- .step(0.01),
- )
- .push(
- slider(0.0..=1.0, background_color.b, move |b| {
- Message::BackgroundColorChanged(Color {
- b,
- ..background_color
- })
- })
- .step(0.01),
- );
-
- Row::new()
- .width(Length::Fill)
- .height(Length::Fill)
- .align_items(Alignment::End)
- .push(
- Column::new()
- .width(Length::Fill)
- .align_items(Alignment::End)
- .push(
- Column::new()
- .padding(10)
- .spacing(10)
- .push(
- Text::new("Background color")
- .style(Color::WHITE),
- )
- .push(sliders)
- .push(
- Text::new(format!("{background_color:?}"))
- .size(14)
- .style(Color::WHITE),
- )
- .push(text_input(
- "Placeholder",
- text,
- Message::TextChanged,
- )),
- ),
- )
- .into()
- }
-}