aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaiface <faiface@ksp.sk>2017-08-18 21:23:24 +0200
committerfaiface <faiface@ksp.sk>2017-08-18 21:23:24 +0200
commit252ed0faad97bbbed3263c1644c10d1ed7cda5d6 (patch)
tree54a2c94b56729991ec1f95573e3f24b602642b6f
parent03403e80262cd4ecfbfdada0aac23882e27d0ef4 (diff)
downloadgui-252ed0faad97bbbed3263c1644c10d1ed7cda5d6.zip
win: minor change
-rw-r--r--win/win.go54
1 files changed, 27 insertions, 27 deletions
diff --git a/win/win.go b/win/win.go
index c9a17cb..e47baf2 100644
--- a/win/win.go
+++ b/win/win.go
@@ -11,6 +11,33 @@ import (
"github.com/go-gl/glfw/v3.2/glfw"
)
+type Option func(*options)
+
+type options struct {
+ title string
+ width, height int
+ resizable bool
+}
+
+func Title(title string) Option {
+ return func(o *options) {
+ o.title = title
+ }
+}
+
+func Size(width, height int) Option {
+ return func(o *options) {
+ o.width = width
+ o.height = height
+ }
+}
+
+func Resizable() Option {
+ return func(o *options) {
+ o.resizable = true
+ }
+}
+
func New(opts ...Option) (*Win, error) {
o := options{
title: "",
@@ -85,33 +112,6 @@ func makeGLFWWin(o *options) (*glfw.Window, error) {
return w, nil
}
-type Option func(*options)
-
-func Title(title string) Option {
- return func(o *options) {
- o.title = title
- }
-}
-
-func Size(width, height int) Option {
- return func(o *options) {
- o.width = width
- o.height = height
- }
-}
-
-func Resizable() Option {
- return func(o *options) {
- o.resizable = true
- }
-}
-
-type options struct {
- title string
- width, height int
- resizable bool
-}
-
type Win struct {
event.Dispatch
w *glfw.Window