Renderers now respect Location of NewRendererOptions.
This commit is contained in:
parent
32c53eb947
commit
7f2e155edd
@ -308,6 +308,8 @@ func (r *Renderer) SetMouseCursor(c ui.MouseCursor) {
|
|||||||
r.cursor = c
|
r.cursor = c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Renderer) SetPosition(p geom.PointF32) { r.disp.SetPosition(int(p.X), int(p.Y)) }
|
||||||
|
|
||||||
func (r *Renderer) SetResourceProvider(factory func() ui.Resources) {
|
func (r *Renderer) SetResourceProvider(factory func() ui.Resources) {
|
||||||
if r.res != nil {
|
if r.res != nil {
|
||||||
r.res.Destroy()
|
r.res.Destroy()
|
||||||
|
@ -20,5 +20,8 @@ func (f rendererFactory) New(title string, width, height int, opts ui.NewRendere
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
renderer.SetWindowTitle(title)
|
renderer.SetWindowTitle(title)
|
||||||
|
if opts.Location != nil {
|
||||||
|
renderer.SetPosition(*opts.Location)
|
||||||
|
}
|
||||||
return renderer, nil
|
return renderer, nil
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,13 @@ func init() {
|
|||||||
type rendererFactory struct{}
|
type rendererFactory struct{}
|
||||||
|
|
||||||
func (f rendererFactory) New(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
|
func (f rendererFactory) New(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
|
||||||
|
location := sdl.Point{X: sdl.WINDOWPOS_UNDEFINED, Y: sdl.WINDOWPOS_UNDEFINED}
|
||||||
|
if opts.Location != nil {
|
||||||
|
location.X = int32(opts.Location.X)
|
||||||
|
location.Y = int32(opts.Location.Y)
|
||||||
|
}
|
||||||
return NewRenderer(title, int32(width), int32(height), NewRendererOptions{
|
return NewRenderer(title, int32(width), int32(height), NewRendererOptions{
|
||||||
Location: sdl.Point{X: sdl.WINDOWPOS_UNDEFINED, Y: sdl.WINDOWPOS_UNDEFINED},
|
Location: location,
|
||||||
Resizable: opts.Resizable,
|
Resizable: opts.Resizable,
|
||||||
VSync: opts.VSync,
|
VSync: opts.VSync,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user