-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a59134f
Showing
9 changed files
with
482 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Slides and demo programs for the Gophercon UK 2019 talk about [Gio](https://gioui.org/) and | ||
[Scatter](https://scatter.im/), "Gio: Cross Platform GUI Programming for Mobile, Desktop, WebAssembly". | ||
|
||
See the slides online [here](https://go-talks.appspot.com/github.com/eliasnaur/gophercon-uk-2019-talk/gophercon-uk-2019-live.slide). | ||
|
||
### Licence | ||
|
||
[The UNLICENCE](https://unlicense.org/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import "gioui.org/ui/app" | ||
import "gioui.org/ui" | ||
import "gioui.org/ui/layout" | ||
import "gioui.org/ui/gesture" | ||
import "gopher.con/simple" | ||
import "fmt" | ||
|
||
func main() { | ||
go func() { | ||
theme := simple.NewTheme() | ||
w := app.NewWindow() | ||
ops := new(ui.Ops) | ||
list := layout.List{Axis: layout.Vertical} | ||
btn := new(simple.IconButton) | ||
n := 3 | ||
for e := range w.Events() { | ||
switch e := e.(type) { | ||
case app.UpdateEvent: | ||
cfg := &e.Config | ||
ops.Reset() | ||
theme.Reset(cfg) | ||
cs := layout.RigidConstraints(e.Size) | ||
|
||
q := w.Queue() | ||
for e, ok := btn.Next(q); ok; e, ok = btn.Next(q) { | ||
if e.Type == gesture.TypeClick { | ||
n += 1 | ||
} | ||
} | ||
|
||
for list.Init(cfg, q, ops, cs, n); list.More(); list.Next() { | ||
cs := list.Constraints() | ||
s := fmt.Sprintf("hello, world %d", list.Index()) | ||
dims := theme.Label(s, 46).Layout(ops, cs) | ||
list.End(dims) | ||
} | ||
list.Layout() | ||
|
||
align := layout.Align{Alignment: layout.SE} | ||
cs = align.Begin(ops, cs) | ||
margins := layout.UniformInset(ui.Dp(8)) | ||
cs = margins.Begin(cfg, ops, cs) | ||
dims := btn.Layout(cfg, ops, cs) | ||
dims = margins.End(dims) | ||
align.End(dims) | ||
|
||
w.Update(ops) | ||
} | ||
} | ||
}() | ||
app.Main() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module gopher.con | ||
|
||
go 1.13 | ||
|
||
require ( | ||
gioui.org/ui v0.0.0-20190822151904-b34389ac2cf9 | ||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 | ||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
gioui.org/ui v0.0.0-20190822151904-b34389ac2cf9 h1:sM1vb0wEkZKjFsi6y6lBhjOAcf6hNlEdLSjfpTIcPqI= | ||
gioui.org/ui v0.0.0-20190822151904-b34389ac2cf9/go.mod h1:dmqi7kyK1sZ03VAkEqzKKpKWfRPCuqrd1eDtSqyhjzY= | ||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 h1:estk1glOnSVeJ9tdEZZc5mAMDZk5lNJNyJ6DvrBkTEU= | ||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= | ||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | ||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9 h1:uc17S921SPw5F2gJo7slQ3aqvr2RwpL7eb3+DZncu3s= | ||
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= | ||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= | ||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= | ||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= | ||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Gio: Cross Platform GUI Programming | ||
Gophercon UK 2019 | ||
|
||
Elias Naur | ||
mail@eliasnaur.com | ||
@elias_naur | ||
https://gioui.org | ||
https://scatter.im | ||
|
||
* Background | ||
|
||
* Background | ||
|
||
- [[https://groups.google.com/forum/#!topic/golang-nuts/OSD91zz2TgQ]["[ANN] Write Android apps in Go"]] - June, 2013 | ||
- [[https://github.com/golang/mobile/commit/d3521b7338121e39da67b21ea7d8942d3b47942e][First gomobile commit]] - July, 2014 | ||
- [[https://www.youtube.com/watch?v=QfFwceFo97E][dotGo talk introducing reverse bindings]] - October, 2016 | ||
- First (private) Gio commit - October, 2017 | ||
- [[https://groups.google.com/forum/#!topic/golang-nuts/H4us4194WQ4][Public release of Gio]] - March, 2019 | ||
|
||
: * Background | ||
|
||
: .image tribaltrouble.jpg 470 _ | ||
|
||
: * Introduction | ||
|
||
: Gio - [[https://gioui.org][https://gioui.org]] | ||
|
||
: Gio is a simple Go module for writing portable and fast graphical interfaces. | ||
|
||
|
||
|
||
* Gio | ||
|
||
[[https://gioui.org][https://gioui.org]] | ||
|
||
Features | ||
|
||
- Immediate mode design. | ||
- Only depends on lowest-level platform libraries. | ||
- GPU accelerated vector and text rendering. | ||
- No garbage generated in drawing or layout code. | ||
- Cross platform (macOS, Linux, Windows, Android, iOS, tvOS, Webassembly). | ||
- Core is 100% Go. OS-specific native interfaces are optional. | ||
|
||
|
||
* Scatter | ||
|
||
|
||
* Scatter | ||
|
||
- [[https://scatter.im][https://scatter.im]] | ||
|
||
In app stores | ||
|
||
- [[https://play.google.com/apps/testing/im.scatter.app][Android Play Store Beta]] | ||
- [[https://testflight.apple.com/join/jsGgyJvC][iOS TestFlight]] | ||
|
||
|
||
* Demo | ||
|
||
* The gio tool | ||
|
||
* Why Gio? | ||
|
||
|
||
|
||
* Why Gio? | ||
|
||
Gio is | ||
|
||
- Simple. Immediate mode design, no hidden state. | ||
- Portable. Runs on the desktop, mobile and browser. | ||
- Fast. GPU accelerated, very little per-frame garbage. | ||
- Public domain source (UNLICENCE). Dual licenced MIT if you prefer that. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func main() { | ||
err := http.ListenAndServe(":8080", http.FileServer(http.Dir(os.Args[1]))) | ||
log.Fatal(err) | ||
} |
Oops, something went wrong.