Create shader function helper in iced_widget
This commit is contained in:
parent
280d3736d5
commit
91d7df52cd
2 changed files with 14 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ use crate::pipeline::Pipeline;
|
||||||
use iced::executor;
|
use iced::executor;
|
||||||
use iced::time::Instant;
|
use iced::time::Instant;
|
||||||
use iced::widget::{
|
use iced::widget::{
|
||||||
checkbox, column, container, row, slider, text, vertical_space, Shader,
|
checkbox, column, container, row, shader, slider, text, vertical_space,
|
||||||
};
|
};
|
||||||
use iced::window;
|
use iced::window;
|
||||||
use iced::{
|
use iced::{
|
||||||
|
|
@ -150,9 +150,8 @@ impl Application for IcedCubes {
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.align_items(Alignment::Center);
|
.align_items(Alignment::Center);
|
||||||
|
|
||||||
let shader = Shader::new(&self.cubes)
|
let shader =
|
||||||
.width(Length::Fill)
|
shader(&self.cubes).width(Length::Fill).height(Length::Fill);
|
||||||
.height(Length::Fill);
|
|
||||||
|
|
||||||
container(
|
container(
|
||||||
column![shader, controls, vertical_space(20),]
|
column![shader, controls, vertical_space(20),]
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,17 @@ where
|
||||||
crate::Canvas::new(program)
|
crate::Canvas::new(program)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a new [`Shader`].
|
||||||
|
///
|
||||||
|
/// [`Shader`]: crate::Shader
|
||||||
|
#[cfg(feature = "wgpu")]
|
||||||
|
pub fn shader<Message, P>(program: P) -> crate::Shader<Message, P>
|
||||||
|
where
|
||||||
|
P: crate::shader::Program<Message>,
|
||||||
|
{
|
||||||
|
crate::Shader::new(program)
|
||||||
|
}
|
||||||
|
|
||||||
/// Focuses the previous focusable widget.
|
/// Focuses the previous focusable widget.
|
||||||
pub fn focus_previous<Message>() -> Command<Message>
|
pub fn focus_previous<Message>() -> Command<Message>
|
||||||
where
|
where
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue