summaryrefslogtreecommitdiffstats
path: root/winit/src/application.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-25 15:00:53 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-25 15:00:53 +0100
commit84874ac5dc2dc787833bcebf37751735f4c4ab42 (patch)
tree50314f680cd8597cf30b89c0236842bec1d834a9 /winit/src/application.rs
parent862859142b50cf74a6fe423a4aa23fd63c152843 (diff)
parentd70021fa68b556e20638f29e2e303f6d156afdb6 (diff)
downloadiced-84874ac5dc2dc787833bcebf37751735f4c4ab42.tar.gz
iced-84874ac5dc2dc787833bcebf37751735f4c4ab42.tar.bz2
iced-84874ac5dc2dc787833bcebf37751735f4c4ab42.zip
Merge pull request #68 from hecrj/feature/application-settings
Allow `Application` configuration with `Settings`
Diffstat (limited to 'winit/src/application.rs')
-rw-r--r--winit/src/application.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs
index ec1444f6..1042b412 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -3,7 +3,7 @@ use crate::{
input::{keyboard, mouse},
renderer::{Target, Windowed},
Cache, Command, Container, Debug, Element, Event, Length, MouseCursor,
- UserInterface,
+ Settings, UserInterface,
};
/// An interactive, native cross-platform application.
@@ -72,7 +72,7 @@ pub trait Application: Sized {
/// It should probably be that last thing you call in your `main` function.
///
/// [`Application`]: trait.Application.html
- fn run()
+ fn run(settings: Settings)
where
Self: 'static,
{
@@ -96,13 +96,15 @@ pub trait Application: Sized {
let mut title = application.title();
- // TODO: Ask for window settings and configure this properly
+ let (width, height) = settings.window.size;
+
let window = WindowBuilder::new()
.with_title(&title)
.with_inner_size(winit::dpi::LogicalSize {
- width: 1280.0,
- height: 1024.0,
+ width: f64::from(width),
+ height: f64::from(height),
})
+ .with_resizable(settings.window.resizable)
.build(&event_loop)
.expect("Open window");