2020-05-15 07:20:44 +00:00
|
|
|
package sdlui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/veandco/go-sdl2/sdl"
|
|
|
|
"opslag.de/schobers/zntg/ui"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
ui.SetRendererFactory(&rendererFactory{})
|
|
|
|
}
|
|
|
|
|
|
|
|
type rendererFactory struct{}
|
|
|
|
|
2020-05-17 06:29:02 +00:00
|
|
|
func (f rendererFactory) New(title string, width, height int, opts ui.NewRendererOptions) (ui.Renderer, error) {
|
2020-05-17 19:02:38 +00:00
|
|
|
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)
|
|
|
|
}
|
2020-05-15 07:20:44 +00:00
|
|
|
return NewRenderer(title, int32(width), int32(height), NewRendererOptions{
|
2022-05-01 10:40:09 +00:00
|
|
|
Borderless: opts.Borderless,
|
|
|
|
Location: location,
|
|
|
|
Resizable: opts.Resizable,
|
|
|
|
VSync: opts.VSync,
|
2020-05-15 07:20:44 +00:00
|
|
|
})
|
|
|
|
}
|