app: [API] make the zero-value Window useful and delete NewWindow

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-12-11 14:03:58 -06:00
parent 6879a30582
commit a880d6403d
2 changed files with 54 additions and 63 deletions
+7 -6
View File
@@ -8,16 +8,17 @@ See https://gioui.org for instructions to set up and run Gio programs.
# Windows
Create a new [Window] by calling [NewWindow]. On mobile platforms or when Gio
is embedded in another project, NewWindow merely connects with a previously
created window.
A Window is run by calling its NextEvent method in a loop. The first time a
method on Window is called, a new GUI window is created and shown. On mobile
platforms or when Gio is embedded in another project, Window merely connects
with a previously created GUI window.
A Window is run by calling its NextEvent method in a loop. The most important event is
[FrameEvent] that prompts an update of the window contents.
The most important event is [FrameEvent] that prompts an update of the window
contents.
For example:
w := app.NewWindow()
w := new(app.Window)
for {
e := w.NextEvent()
if e, ok := e.(app.FrameEvent); ok {