You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PistonWindow struct stores a GlutinWindow and that stores a GlWindow. Only GlWindow has a bunch of the properties we need to access in order to get/set all the information we need to in Drawing. This means that in order to access most of what we need, we often need to do something like window.window.window.blah().
The API is overall very clunky and difficult to use. There are a lot setters, but barely any getters. That means that we often cannot see the "actual" value of some part of the window.
For example, we cannot tell whether the window is maximized or not. We store our own maximized boolean and update it whenever Drawing::maximize() is called. This works okay, but stops being reliable if the user clicks the maximize button on the window itself. There is no event that provides information about that happening so we can't even track it manually.
This lack of information and poor API has made it so that our maximize(), unmaximize() and is_maximized() methods are all unstable. We don't even have methods to do things like disable resizing or minimize the window. This is despite WindowSettings supporting a set_resizeable method. That means that windows can be made resizeable or not during construction, but not set that way after they have been created.
1. Problems to Address in Window Library
Addressing all of these problems may involve moving to a new library or maybe contributing to/forking winit/PistonWindow/glutin.
Solution must be cross platform (Windows, Mac, Ubuntu/Linux)
Solution must not require any additional installation (i.e. anyone should just be able to compile a turtle application with cargo build without installing additional dependencies)
If additional installation is required, it is done automatically on the major platforms we support
No more window.window.window
getters for all window properties so that we no longer need to track a "current" drawing state
methods for enabling/disabling resizing of the window after the window has been created
methods for minimizing/unminimizing
(optional if getters are good enough) events for entering/exiting fullscreen and maximized
We should consider checking out the very in progress Druid framework. It looks promising because it allows us to define how widgets get painted directly. That might actually be the right level of abstraction for a project like this.
The
PistonWindow
struct stores aGlutinWindow
and that stores aGlWindow
. OnlyGlWindow
has a bunch of the properties we need to access in order to get/set all the information we need to inDrawing
. This means that in order to access most of what we need, we often need to do something likewindow.window.window.blah()
.turtle/src/renderer.rs
Lines 28 to 40 in b51e3e0
The API is overall very clunky and difficult to use. There are a lot setters, but barely any getters. That means that we often cannot see the "actual" value of some part of the window.
For example, we cannot tell whether the window is maximized or not. We store our own
maximized
boolean and update it wheneverDrawing::maximize()
is called. This works okay, but stops being reliable if the user clicks the maximize button on the window itself. There is no event that provides information about that happening so we can't even track it manually.This lack of information and poor API has made it so that our
maximize()
,unmaximize()
andis_maximized()
methods are all unstable. We don't even have methods to do things like disable resizing or minimize the window. This is despiteWindowSettings
supporting aset_resizeable
method. That means that windows can be made resizeable or not during construction, but not set that way after they have been created.1. Problems to Address in Window Library
Addressing all of these problems may involve moving to a new library or maybe contributing to/forking winit/PistonWindow/glutin.
cargo build
without installing additional dependencies)window.window.window
2. After Problems Have Been Addressed
is_maximized()
is accurate even if window maximize button is usedmaximize()
,unmaximize()
andis_maximized()
Drawing
foris_resizeable()
andset_resizeable()
is_minimized()
,minimize()
,unminimize()
The text was updated successfully, but these errors were encountered: