Added support for borderless windows.
This commit is contained in:
parent
eb46741165
commit
ddf9476920
@ -13,6 +13,7 @@ type rendererFactory struct{}
|
||||
|
||||
func (f rendererFactory) New(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
|
||||
renderer, err := NewRenderer(width, height, allg5.NewDisplayOptions{
|
||||
Frameless: opts.Borderless,
|
||||
Resizable: opts.Resizable,
|
||||
Vsync: opts.VSync,
|
||||
})
|
||||
|
@ -33,6 +33,7 @@ var _ ui.Renderer = &Renderer{}
|
||||
var _ ui.Texture = &Renderer{}
|
||||
|
||||
type NewRendererOptions struct {
|
||||
Borderless bool
|
||||
Location sdl.Point
|
||||
Resizable bool
|
||||
VSync bool
|
||||
@ -57,6 +58,9 @@ func NewRenderer(title string, width, height int32, opts NewRendererOptions) (*R
|
||||
}
|
||||
sdl.SetHint(sdl.HINT_RENDER_SCALE_QUALITY, "1")
|
||||
windowFlags := uint32(sdl.WINDOW_SHOWN)
|
||||
if opts.Borderless {
|
||||
windowFlags |= sdl.WINDOW_BORDERLESS
|
||||
}
|
||||
if opts.Resizable {
|
||||
windowFlags |= sdl.WINDOW_RESIZABLE
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ func (f rendererFactory) New(title string, width, height int, opts ui.NewRendere
|
||||
location.Y = int32(opts.Location.Y)
|
||||
}
|
||||
return NewRenderer(title, int32(width), int32(height), NewRendererOptions{
|
||||
Borderless: opts.Borderless,
|
||||
Location: location,
|
||||
Resizable: opts.Resizable,
|
||||
VSync: opts.VSync,
|
||||
|
@ -41,6 +41,7 @@ func SetRendererFactory(factory RendererFactory) {
|
||||
// NewRendererOptions provides options when creating a new renderer.
|
||||
type NewRendererOptions struct {
|
||||
Location *geom.PointF32
|
||||
Borderless bool
|
||||
Resizable bool
|
||||
VSync bool
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user