From 252ed0faad97bbbed3263c1644c10d1ed7cda5d6 Mon Sep 17 00:00:00 2001 From: faiface Date: Fri, 18 Aug 2017 21:23:24 +0200 Subject: win: minor change --- win/win.go | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'win') 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 -- cgit v1.2.3