Merge pull request #237 from fgrosse/more-window-hints
Add window hints to created maximized or invisible windows
This commit is contained in:
commit
585f7c1f14
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
- Gamepad API added
|
- Gamepad API added
|
||||||
- Support setting an initial window position
|
- Support setting an initial window position
|
||||||
|
- Support hiding the window initially
|
||||||
|
- Support creating maximized windows
|
||||||
|
|
||||||
## [v0.10.0-beta] 2020-05-10
|
## [v0.10.0-beta] 2020-05-10
|
||||||
- Add `WindowConfig.TransparentFramebuffer` option to support window transparency onto the background
|
- Add `WindowConfig.TransparentFramebuffer` option to support window transparency onto the background
|
||||||
|
|
|
@ -43,10 +43,10 @@ type WindowConfig struct {
|
||||||
// specified Monitor.
|
// specified Monitor.
|
||||||
Monitor *Monitor
|
Monitor *Monitor
|
||||||
|
|
||||||
// Whether the Window is resizable.
|
// Resizable specifies whether the window will be resizable by the user.
|
||||||
Resizable bool
|
Resizable bool
|
||||||
|
|
||||||
// Undecorated Window ommits the borders and decorations (close button, etc.).
|
// Undecorated Window omits the borders and decorations (close button, etc.).
|
||||||
Undecorated bool
|
Undecorated bool
|
||||||
|
|
||||||
// NoIconify specifies whether fullscreen windows should not automatically
|
// NoIconify specifies whether fullscreen windows should not automatically
|
||||||
|
@ -68,6 +68,13 @@ type WindowConfig struct {
|
||||||
// VSync (vertical synchronization) synchronizes Window's framerate with the framerate of
|
// VSync (vertical synchronization) synchronizes Window's framerate with the framerate of
|
||||||
// the monitor.
|
// the monitor.
|
||||||
VSync bool
|
VSync bool
|
||||||
|
|
||||||
|
// Maximized specifies whether the window is maximized.
|
||||||
|
Maximized bool
|
||||||
|
|
||||||
|
// Invisible specifies whether the window will be initially hidden.
|
||||||
|
// You can make the window visible later using Window.Show().
|
||||||
|
Invisible bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window is a window handler. Use this type to manipulate a window (input, drawing, etc.).
|
// Window is a window handler. Use this type to manipulate a window (input, drawing, etc.).
|
||||||
|
@ -122,6 +129,8 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
|
||||||
glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop])
|
glfw.WindowHint(glfw.Floating, bool2int[cfg.AlwaysOnTop])
|
||||||
glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify])
|
glfw.WindowHint(glfw.AutoIconify, bool2int[!cfg.NoIconify])
|
||||||
glfw.WindowHint(glfw.TransparentFramebuffer, bool2int[cfg.TransparentFramebuffer])
|
glfw.WindowHint(glfw.TransparentFramebuffer, bool2int[cfg.TransparentFramebuffer])
|
||||||
|
glfw.WindowHint(glfw.Maximized, bool2int[cfg.Maximized])
|
||||||
|
glfw.WindowHint(glfw.Visible, bool2int[!cfg.Invisible])
|
||||||
|
|
||||||
if cfg.Position.X != 0 || cfg.Position.Y != 0 {
|
if cfg.Position.X != 0 || cfg.Position.Y != 0 {
|
||||||
glfw.WindowHint(glfw.Visible, glfw.False)
|
glfw.WindowHint(glfw.Visible, glfw.False)
|
||||||
|
@ -477,3 +486,11 @@ func (w *Window) Color(at pixel.Vec) pixel.RGBA {
|
||||||
func (w *Window) Canvas() *Canvas {
|
func (w *Window) Canvas() *Canvas {
|
||||||
return w.canvas
|
return w.canvas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show makes the window visible, if it was previously hidden. If the window is
|
||||||
|
// already visible or is in full screen mode, this function does nothing.
|
||||||
|
func (w *Window) Show() {
|
||||||
|
mainthread.Call(func() {
|
||||||
|
w.window.Show()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue