Sander Schobers
cdfb863ab0
Added Action{,s}. List of actions that can be used to defer cleanup code (see NewRenderer implementations). Added TextInputEvent (replaces the old KeyPressEvent) and added to new events KeyDown & KeyUp. Added VSync to NewRendererOptions. Removed IconScale from button. Added ImageSource interface that replaces the Image/Texture method on the Texture interface. This makes converting back a texture to an image optional (since this is atypical for a hardware texture for instance). Added new KeyModifier: OSCommand (Windows/Command key). Added KeyState that can keep the state of keys (pressed or not). Added KeyEnter, representing the Enter key. Changed signatures of CreateTexture methods in Renderer. Changed signatures of icon related method (removed factories). Basic example now depends on sdlgui.
39 lines
1.0 KiB
Go
39 lines
1.0 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)
|
|
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)
|
|
Font(name string) Font
|
|
Rectangle(r geom.RectangleF32, c color.Color, thickness float32)
|
|
RegisterFont(name, path string, size int) error
|
|
RenderTo(Texture)
|
|
RenderToDisplay()
|
|
SetMouseCursor(c MouseCursor)
|
|
Size() geom.PointF32
|
|
Target() Texture
|
|
Text(p geom.PointF32, font string, color color.Color, text string)
|
|
TextAlign(p geom.PointF32, font string, color color.Color, text string, align HorizontalAlignment)
|
|
}
|