aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-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