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
|
||||
}
|
||||
|
||||
func (r *Renderer) SetPosition(p geom.PointF32) { r.disp.SetPosition(int(p.X), int(p.Y)) }
|
||||
|
||||
func (r *Renderer) SetResourceProvider(factory func() ui.Resources) {
|
||||
if r.res != nil {
|
||||
r.res.Destroy()
|
||||
|
@ -20,5 +20,8 @@ func (f rendererFactory) New(title string, width, height int, opts ui.NewRendere
|
||||
return nil, err
|
||||
}
|
||||
renderer.SetWindowTitle(title)
|
||||
if opts.Location != nil {
|
||||
renderer.SetPosition(*opts.Location)
|
||||
}
|
||||
return renderer, nil
|
||||
}
|
||||
|
@ -12,8 +12,13 @@ func init() {
|
||||
type rendererFactory struct{}
|
||||
|
||||
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{
|
||||
Location: sdl.Point{X: sdl.WINDOWPOS_UNDEFINED, Y: sdl.WINDOWPOS_UNDEFINED},
|
||||
Location: location,
|
||||
Resizable: opts.Resizable,
|
||||
VSync: opts.VSync,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user