Implement iced_glutin 🎉
This commit is contained in:
parent
a1a5fcfd46
commit
e0e4ee73fe
31 changed files with 718 additions and 498 deletions
|
|
@ -8,6 +8,11 @@ mod platform;
|
|||
|
||||
pub use platform::PlatformSpecific;
|
||||
|
||||
use crate::conversion;
|
||||
use crate::Mode;
|
||||
use winit::monitor::MonitorHandle;
|
||||
use winit::window::WindowBuilder;
|
||||
|
||||
/// The settings of an application.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Default)]
|
||||
pub struct Settings<Flags> {
|
||||
|
|
@ -38,6 +43,37 @@ pub struct Window {
|
|||
pub platform_specific: platform::PlatformSpecific,
|
||||
}
|
||||
|
||||
impl Window {
|
||||
pub fn into_builder(
|
||||
self,
|
||||
title: &str,
|
||||
mode: Mode,
|
||||
primary_monitor: MonitorHandle,
|
||||
) -> WindowBuilder {
|
||||
let mut window_builder = WindowBuilder::new();
|
||||
|
||||
let (width, height) = self.size;
|
||||
|
||||
window_builder = window_builder
|
||||
.with_title(title)
|
||||
.with_inner_size(winit::dpi::LogicalSize { width, height })
|
||||
.with_resizable(self.resizable)
|
||||
.with_decorations(self.decorations)
|
||||
.with_fullscreen(conversion::fullscreen(primary_monitor, mode));
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use winit::platform::windows::WindowBuilderExtWindows;
|
||||
|
||||
if let Some(parent) = self.platform_specific.parent {
|
||||
window_builder = window_builder.with_parent_window(parent);
|
||||
}
|
||||
}
|
||||
|
||||
window_builder
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Window {
|
||||
fn default() -> Window {
|
||||
Window {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue