Closed bvssvni closed 9 years ago
The old code was:
pub trait Window<E = Input>:
SwapBuffers
+ PollEvent<E>
+ GetShouldClose + SetShouldClose
+ GetSize
+ SetCaptureCursor
+ GetDrawSize
+ GetTitle + SetTitle
+ GetExitOnEsc + SetExitOnEsc {}
I think we could auto implement a trait that looks like a "normal" interface for now. Some people prefer to track the window and stay polymorphic over the window back-end. This way they would only need to import one trait to use the window. The trait should not use the property types.
Alternative is to make people implement their own Window
trait. It is not easy to decide which properties the window should have, and some back-ends might not support all the methods, so if we want to support a Window
trait then there must be a defined behavior for all properties.
One convention that works in many cases is to do:
use sdl2_window::Sdl2Window as Window;
This could be suggested as way to fix the problem, but it won't work for libraries that tries to use generics.
Closing because of outdated.
I removed it because the
where
constraints did not propagate properly. I don't know whether this is intentional yet and plan to investigate this closer. A solution would be to add wrapper methods to theWindow
trait. However, I don't know how this should be done "right", so I did the same as usual, to do as little as possible.