zntg/sdlui/rendererfactory.go

21 lines
511 B
Go
Raw Normal View History

package sdlui
import (
"github.com/veandco/go-sdl2/sdl"
"opslag.de/schobers/zntg/ui"
)
func init() {
ui.SetRendererFactory(&rendererFactory{})
}
type rendererFactory struct{}
func (f rendererFactory) New(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
return NewRenderer(title, int32(width), int32(height), NewRendererOptions{
Location: sdl.Point{X: sdl.WINDOWPOS_UNDEFINED, Y: sdl.WINDOWPOS_UNDEFINED},
Resizable: opts.Resizable,
VSync: opts.VSync,
})
}