minor changes

This commit is contained in:
faiface 2017-03-16 00:15:39 +01:00
parent 311b474e89
commit 19ba78bb0c
1 changed files with 6 additions and 8 deletions

View File

@ -67,7 +67,7 @@ type Window struct {
} }
} }
var currentWindow *Window var currWin *Window
// NewWindow creates a new Window with it's properties specified in the provided config. // NewWindow creates a new Window with it's properties specified in the provided config.
// //
@ -78,9 +78,7 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
false: glfw.False, false: glfw.False,
} }
w := &Window{ w := &Window{bounds: cfg.Bounds}
bounds: cfg.Bounds,
}
err := mainthread.CallErr(func() error { err := mainthread.CallErr(func() error {
var err error var err error
@ -97,8 +95,8 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
glfw.WindowHint(glfw.Maximized, bool2int[cfg.Maximized]) glfw.WindowHint(glfw.Maximized, bool2int[cfg.Maximized])
var share *glfw.Window var share *glfw.Window
if currentWindow != nil { if currWin != nil {
share = currentWindow.window share = currWin.window
} }
_, _, width, height := intBounds(cfg.Bounds) _, _, width, height := intBounds(cfg.Bounds)
w.window, err = glfw.CreateWindow( w.window, err = glfw.CreateWindow(
@ -346,10 +344,10 @@ func (w *Window) VSync() bool {
// Note: must be called inside the main thread. // Note: must be called inside the main thread.
func (w *Window) begin() { func (w *Window) begin() {
if currentWindow != w { if currWin != w {
w.window.MakeContextCurrent() w.window.MakeContextCurrent()
glhf.Init() glhf.Init()
currentWindow = w currWin = w
} }
} }