zntg/ui/renderer.go
Sander Schobers 3591e22c97 Added Fonts() to context similarly as Textures().
- Fonts are now managed by context instead of the implementation specific renderers.
2020-05-15 15:42:24 +02:00

42 lines
1.1 KiB
Go

package ui
import (
"image"
"image/color"
"opslag.de/schobers/geom"
)
type Renderer interface {
// Events
PushEvents(t EventTarget, wait bool)
Refresh()
// Lifetime
Destroy() error
// Drawing
Clear(c color.Color)
CreateFontPath(path string, size int) (Font, error)
CreateTexture(m ImageSource) (Texture, error)
CreateTextureGo(m image.Image, source bool) (Texture, error)
CreateTexturePath(path string, source bool) (Texture, error)
CreateTextureTarget(w, h float32) (Texture, error)
DefaultTarget() Texture
DrawTexture(t Texture, p geom.PointF32)
DrawTextureOptions(t Texture, p geom.PointF32, opts DrawOptions)
FillRectangle(r geom.RectangleF32, c color.Color)
Rectangle(r geom.RectangleF32, c color.Color, thickness float32)
RenderTo(Texture)
RenderToDisplay()
SetMouseCursor(c MouseCursor)
Size() geom.PointF32
Target() Texture
Text(font Font, p geom.PointF32, color color.Color, text string)
TextAlign(font Font, p geom.PointF32, color color.Color, text string, align HorizontalAlignment)
// Resources
Resources() Resources
SetResourceProvider(factory func() Resources)
}