Documentation
¶
Overview ¶
The paint package provides utilities for painting all kinds of things using Ebiten.
Index ¶
- type AssetManager
- type EbitenPainter
- func (er *EbitenPainter) Clear()
- func (er *EbitenPainter) DrawRaw(image *ebiten.Image, op *ebiten.DrawImageOptions)
- func (er *EbitenPainter) Paint(command RenderCommand)
- func (er *EbitenPainter) PaintMulti(commands []RenderCommand)
- func (er *EbitenPainter) Screen() *ebiten.Image
- func (e *EbitenPainter) SetTransform(transform Transform)
- func (e *EbitenPainter) Transform() Transform
- type Image
- type Line
- type Painter
- type Rectangle
- type RectangleStroke
- type RenderCommand
- type Text
- type Transform
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetManager ¶
type AssetManager struct {
// contains filtered or unexported fields
}
func NewAssetManager ¶
func NewAssetManager(fs fs.FS) *AssetManager
NewAssetManager creates a new asset manager for loading images and more based on a file system. You can, for example, use this with go:embed (which you should probably).
func (*AssetManager) Clear ¶
func (am *AssetManager) Clear()
func (*AssetManager) GetFont ¶
func (am *AssetManager) GetFont(path string) (*text.GoTextFaceSource, error)
GetFont loads a font from the asset file system and caches it.
Automatic cleanup of the cache is planned.
type EbitenPainter ¶
type EbitenPainter struct {
// contains filtered or unexported fields
}
func NewEbitenPainter ¶
func NewEbitenPainter(screen *ebiten.Image, antialias bool, assets *AssetManager) *EbitenPainter
Create a new renderer using Ebitengine's image API and a custom filesystem for assets.
func (*EbitenPainter) Clear ¶
func (er *EbitenPainter) Clear()
func (*EbitenPainter) DrawRaw ¶
func (er *EbitenPainter) DrawRaw(image *ebiten.Image, op *ebiten.DrawImageOptions)
func (*EbitenPainter) Paint ¶
func (er *EbitenPainter) Paint(command RenderCommand)
func (*EbitenPainter) PaintMulti ¶
func (er *EbitenPainter) PaintMulti(commands []RenderCommand)
func (*EbitenPainter) Screen ¶
func (er *EbitenPainter) Screen() *ebiten.Image
func (*EbitenPainter) SetTransform ¶
func (e *EbitenPainter) SetTransform(transform Transform)
func (*EbitenPainter) Transform ¶
func (e *EbitenPainter) Transform() Transform
type Image ¶
type Line ¶
type Painter ¶
type Painter interface {
// Get the current transform
Transform() Transform
// Set a transform
SetTransform(transform Transform)
// Clear the canvas for a new frame
Clear()
// Should draw one render command on top of everything else that has already been drawn.
Paint(command RenderCommand)
// Draw an image directly onto the screen
DrawRaw(image *ebiten.Image, op *ebiten.DrawImageOptions)
// Should draw all of the commands in order, the first index gets drawn first, etc.
PaintMulti(commands []RenderCommand)
}
type Rectangle ¶
type RectangleStroke ¶
type RectangleStroke struct {
Position scath.Vec `json:"position"`
Size scath.Vec `json:"size"`
Color color.Color `json:"color"`
BorderRadius float64 `json:"borderRadius"`
Thickness float64 `json:"thickness"`
}
func (RectangleStroke) ID ¶
func (RectangleStroke) ID() string
type RenderCommand ¶
type RenderCommand interface {
ID() string
}
This is so we can actually parse commands to JSON. Why? For live-reloading, but that's a future ambition.
type Text ¶
type Text struct {
Direction text.Direction `json:"direction"`
Font string `json:"font"`
Color color.Color `json:"color"`
FontSize float64 `json:"fontSize"`
LineSpacing float64 `json:"lineSpacing"`
Text string `json:"text"`
Position scath.Vec `json:"position"`
PrimaryAlign text.Align `json:"primaryAlign"`
SecondaryAlign text.Align `json:"secondaryAlign"`
}
Click to show internal directories.
Click to hide internal directories.