zntg/allg5ui/rendererfactory.go

25 lines
513 B
Go
Raw Normal View History

package allg5ui
import (
"opslag.de/schobers/allg5"
"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) {
renderer, err := NewRenderer(width, height, allg5.NewDisplayOptions{
Resizable: opts.Resizable,
Vsync: opts.VSync,
})
if err != nil {
return nil, err
}
renderer.SetWindowTitle(title)
return renderer, nil
}