Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Window building #161

Open
kvark opened this issue Jan 5, 2018 · 2 comments
Open

[RFC] Window building #161

kvark opened this issue Jan 5, 2018 · 2 comments

Comments

@kvark
Copy link
Collaborator

kvark commented Jan 5, 2018

Currently, we sort-of re-implement a small fraction of glutin::WindowBuilder in our three::Builder. Given that glutin just re-exports winit, and that one is cross-platform and used by gfx-rs's windowing crates, I believe we should be basing around it.

There are only 2 properties we need (so far) outside of winit stuff: vertical sync and shader path. Perhaps, we could make this work like:

struct WindowSettings {
  pub builder: winit::WindowBuilder,
  pub vsync: bool,
  pub shader_path: Option<PathBuf>,
}

impl Window {
  fn new(title: Into<String>) -> Self {}
  fn from_settings(ws: WindowSettings) -> Result<Self, OurError> {}
}

The second choice would be for clients who need to fine-tune everything, and they can handle the error if something goes wrong.

@vitvakatu
Copy link
Member

The thing I like in our current design is that it needs just a few steps to adjust some settings.
For example, it's common situation for me when I need to load shaders from some path for some example. With current design, all I need is:

  1. change new to builder
  2. add new shader_directory(...) function call
  3. end up with build()

With this approach I would need to add new WindowSettings struct, set up winit::WindowBuilder and change new(...) to from_settings(...).unwrap().

@alteous
Copy link
Member

alteous commented Jan 7, 2018

As stated in #129, I think the display/windowing system should be independent of the rest of the crate features, but that's sort of off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants