From b7d5e41486f79642255e3dac1a27ab7a0e2a882f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedrich=20Gro=C3=9Fe?= Date: Sun, 3 May 2020 19:38:54 +0200 Subject: [PATCH 1/2] Support setting an initial window position --- pixelgl/window.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pixelgl/window.go b/pixelgl/window.go index 9472659..f3f3ddf 100644 --- a/pixelgl/window.go +++ b/pixelgl/window.go @@ -36,6 +36,9 @@ type WindowConfig struct { // Bounds specify the bounds of the Window in pixels. Bounds pixel.Rect + // Initial window position + Position pixel.Vec + // If set to nil, the Window will be windowed. Otherwise it will be fullscreen on the // specified Monitor. Monitor *Monitor @@ -113,6 +116,10 @@ func NewWindow(cfg WindowConfig) (*Window, error) { glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop]) glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify]) + if cfg.Position.X != 0 || cfg.Position.Y != 0 { + glfw.WindowHint(glfw.Visible, glfw.False) + } + var share *glfw.Window if currWin != nil { share = currWin.window @@ -129,6 +136,11 @@ func NewWindow(cfg WindowConfig) (*Window, error) { return err } + if cfg.Position.X != 0 || cfg.Position.Y != 0 { + w.window.SetPos(int(cfg.Position.X), int(cfg.Position.Y)) + w.window.Show() + } + // enter the OpenGL context w.begin() glhf.Init() From 79a3bd7c631bb177c78d3a8de2f2291110b922c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Friedrich=20Gro=C3=9Fe?= Date: Sat, 9 May 2020 21:17:52 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ed4ade..a882259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] - Gamepad API? +- Support setting an initial window position ## [v0.10.0-alpha] 2020-05-08 - Upgrade to GLFW 3.3! :tada: