Introduce Error::ContextCreationFailed

This commit is contained in:
Richard 2022-01-27 04:00:53 -03:00
parent a33e320521
commit 1e62fdf069
5 changed files with 39 additions and 18 deletions

View file

@ -80,12 +80,25 @@ where
.or_else(|_| second_builder.build_windowed(builder, &event_loop))
.map_err(|error| {
use glutin::CreationError;
use iced_graphics::Error as ContextError;
match error {
CreationError::Window(error) => {
Error::WindowCreationFailed(error)
}
_ => Error::GraphicsAdapterNotFound,
CreationError::OpenGlVersionNotSupported => {
Error::ContextCreationFailed(
ContextError::VersionNotSupported,
)
}
CreationError::NoAvailablePixelFormat => {
Error::ContextCreationFailed(
ContextError::NoAvailablePixelFormat,
)
}
error => Error::ContextCreationFailed(
ContextError::BackendError(error.to_string()),
),
}
})?;