sprites

package
v0.0.0-...-d4fbba4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sheet

type Sheet struct {
	// contains filtered or unexported fields
}

Sheet contains the data and meta-data for a sprite sheet.

func NewSheet

func NewSheet(source *ebiten.Image, width, height int) *Sheet

NewSheet creates a new sprite sheet from the given image, with fixed width and height sprites.

func (*Sheet) Size

func (s *Sheet) Size() (width, height int)

Size returns the width and height of a single sprite in this sheet, in pixels.

func (*Sheet) Sprite

func (s *Sheet) Sprite(index int) *ebiten.Image

Sprite retrieves the sprite at the given index within the sheet.

type TextRenderer

type TextRenderer struct {
	// contains filtered or unexported fields
}

TextRenderer provides functions for rendering blocks of text from a sprite-sheet based font.

func NewTextRenderer

func NewTextRenderer(sheet *Sheet, chars string, caseSensitive bool) *TextRenderer

NewTextRenderer creates a new TextRenderer that will use sprites from the given sheets corresponding to the set of characters. If caseSensitive is set to false then case is ignored when searching for a matching sprite.

func (*TextRenderer) Render

func (t *TextRenderer) Render(image *ebiten.Image, x, y float64, text string)

Render renders the given text line by line starting at the given co-ordinates.

func (*TextRenderer) RenderWrapped

func (t *TextRenderer) RenderWrapped(image *ebiten.Image, x, y float64, width float64, text string)

RenderWrapped renders the given text onto the image, starting at the given co-ordinates. Wrapping is done at the nearest space character; if a single word is longer than the maximum width then it will be cut mid-word.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL