Draft first working version of iced_glow 🎉

This commit is contained in:
Héctor Ramón Jiménez 2020-05-19 14:23:28 +02:00
parent 33448508a5
commit d4743183d4
51 changed files with 3212 additions and 42 deletions

View file

@ -5,7 +5,7 @@ use raw_window_handle::HasRawWindowHandle;
/// A graphics backend that can render to windows.
pub trait Backend: Sized {
/// The settings of the backend.
type Settings: Default;
type Settings: Default + Clone;
/// The iced renderer of the backend.
type Renderer: crate::Renderer;
@ -16,10 +16,10 @@ pub trait Backend: Sized {
/// The swap chain of the backend.
type SwapChain;
/// Creates a new [`Backend`] and an associated iced renderer.
/// Creates a new [`Backend`].
///
/// [`Backend`]: trait.Backend.html
fn new(settings: Self::Settings) -> (Self, Self::Renderer);
fn new(settings: Self::Settings) -> Self;
/// Crates a new [`Surface`] for the given window.
///
@ -29,6 +29,11 @@ pub trait Backend: Sized {
window: &W,
) -> Self::Surface;
/// Crates a new [`Renderer`].
///
/// [`Renderer`]: #associatedtype.Renderer
fn create_renderer(&mut self, settings: Self::Settings) -> Self::Renderer;
/// Crates a new [`SwapChain`] for the given [`Surface`].
///
/// [`SwapChain`]: #associatedtype.SwapChain