instanced

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package instanced is the sprites a Direct source draws on the GPU as instances, by layer or in the order they came.

Index

Constants

View Source
const (
	TakesAll  = compose.TakesAll
	Cutout    = compose.Cutout
	Uncovered = compose.Uncovered
)

TakesAll takes every shade and the lamps' light, as a zero Taking does.

Variables

This section is empty.

Functions

func BadgeWidth added in v0.20.0

func BadgeWidth(n int, shape BadgeShape, size float32) float32

BadgeWidth is how many shown pixels across a badge of shape at least size across is to hold n written in its middle, nothing written where n is not positive. It may be asked on any goroutine.

Types

type At

type At = compose.At

the names of compose's, gfx's and text's the sprites and labels draw with

type AtlasSource

type AtlasSource = gfx.AtlasSource

the names of compose's, gfx's and text's the sprites and labels draw with

type BadgeShape added in v0.20.0

type BadgeShape uint8

BadgeShape is the outline of a badge.

const (
	// BadgeDisc is a round badge.
	BadgeDisc BadgeShape = iota
	// BadgeDiamond is a square badge standing on a corner.
	BadgeDiamond
)

type DrawMeshOptions

type DrawMeshOptions = gfx.DrawMeshOptions

the names of compose's, gfx's and text's the sprites and labels draw with

type Font added in v0.20.0

type Font = text.Font

the names of compose's, gfx's and text's the sprites and labels draw with

type Labels added in v0.20.0

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

Labels is text a Direct source draws on the GPU by points of the world, a size in shown pixels however far the point, each glyph tested for depth as though it stood upright on its point; and badges, shapes with a number in, drawn alike.

func (*Labels) Badge added in v0.20.0

func (l *Labels) Badge(n int, shape BadgeShape, x, y, z, deep, dx, dy, width float32,
	fill, rim color.RGBA)

Badge adds a badge of shape width shown pixels across by the point (x, y) of the world seen at height z, its middle dx and dy shown pixels from where the point shows, standing at height deep, filled with fill within a rim in rim, and n, where it is positive, written in its middle in white or black, whichever stands out of fill.

func (*Labels) Draw added in v0.20.0

func (l *Labels) Draw(t Target, cam camera.Camera, u Uniforms)

Draw draws the gathered text into the target's screen, a viewport cam's size, by its points as cam lays them under the frame's uniforms u, keeping it for another draw till Reset; against the target's depth, where it has one, what shows of it written. A camera that cannot say its lines of sight draws none.

func (*Labels) Reset added in v0.20.0

func (l *Labels) Reset()

Reset drops what was gathered.

func (*Labels) Text added in v0.20.0

func (l *Labels) Text(font *Font, s string, x, y, z, deep, dx, dy float32, c color.RGBA)

Text adds s in font by the point (x, y) of the world seen at height z, its first line's top-left dx and dy shown pixels from where the point shows, standing at height deep, in c.

func (*Labels) Wrap added in v0.20.0

func (l *Labels) Wrap(w, h float32, x, y bool)

Wrap has the labels laid over a world w by h that wraps across where x says and down where y does, each where a camera's window sees it.

type Light

type Light = compose.Light

the names of compose's, gfx's and text's the sprites and labels draw with

type SpriteID

type SpriteID = gfx.SpriteID

the names of compose's, gfx's and text's the sprites and labels draw with

type Sprites

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

Sprites is sprites a Direct source draws on the GPU as instances, by Layer or else in the order they came, one call a run sharing an atlas: each a rectangle of the world the GPU lays on the screen as the camera does, what Frame.SpriteRectUV would lay, without the frame.

func (*Sprites) Cutout added in v0.21.0

func (s *Sprites) Cutout(on bool)

Cutout has the pieces added next drawn in the cutout pass: whole, cut at half their alpha, writing the depth, front to back; off, among what is seen through.

func (*Sprites) Direct

func (s *Sprites) Direct(share float32)

Direct has the pieces added next lit share of their light by the distant light, 0 to 1: what a shadow over them takes away.

func (*Sprites) Draw

func (s *Sprites) Draw(t Target, cam camera.Camera, u Uniforms)

Draw draws the gathered sprites into the target's screen, a viewport cam's size, as cam lays them under the frame's uniforms u, keeping them for another draw till Reset; into the target's depth, where it has one, each at its height, what shows of it written. In the cutout pass the pieces added under Cutout alone, cut at half their alpha, front to back; in the pass seen through the rest and the points; in the pass of what is uncovered, where those added under Uncover lie. A camera that cannot say its lines of sight draws none.

func (*Sprites) Fog

func (s *Sprites) Fog(amount float32)

Fog has the pieces added next turn into the frame's Fog colour by amount, 0 clear to 1 all fog.

func (*Sprites) GiveWay added in v0.22.0

func (s *Sprites) GiveWay(on bool)

GiveWay has the pieces added next give way to those uncovered (Uncover), their own or another source's.

func (*Sprites) GivesWay added in v0.22.0

func (s *Sprites) GivesWay() bool

GivesWay reports whether any piece gathered gives way.

func (*Sprites) Layer

func (s *Sprites) Layer(at At, under bool)

Layer has the pieces added next lie at at, drawn back to front and at one place those under before the rest; pieces added before any Layer lie at the zero At.

func (*Sprites) Point added in v0.19.0

func (s *Sprites) Point(atlas AtlasSource, id SpriteID, x, y, w, h, z, deep float32, light Light)

Point adds sprite id of atlas as a point at the middle (x, y) of a box w by h, seen at height z and lying at height deep, in light: the box as large as it shows, a pixel at least each way, as much less opaque as it shows less. Drawn after the pieces, by no Layer.

func (*Sprites) Rect

func (s *Sprites) Rect(
	atlas AtlasSource, id SpriteID, x0, y0, x1, y1, u0, v0, u1, v1 float32, light Light)

Rect adds the part u0..u1, v0..v1 of sprite id of atlas over the world rectangle (x0, y0)-(x1, y1), in light.

func (*Sprites) Reset

func (s *Sprites) Reset()

Reset drops what was gathered.

func (*Sprites) Shelter added in v0.22.0

func (s *Sprites) Shelter(at uint16)

Shelter has the pieces added next drawn under the frame's shelter at (Shadowing.Shelter), 0 in the open: their light the lamps' alone, what of the sky's gets in worked out pixel by pixel.

func (*Sprites) Take

func (s *Sprites) Take(takes Taking)

Take has the pieces added next take the shade takes says.

func (*Sprites) Turned

func (s *Sprites) Turned(
	atlas AtlasSource, id SpriteID, x0, y0, x1, y1, angle float32, light Light)

Turned adds the whole of sprite id of atlas over the world rectangle (x0, y0)-(x1, y1), turned by angle radians about its middle, anticlockwise as the world is seen from above, in light.

func (*Sprites) Uncover added in v0.22.0

func (s *Sprites) Uncover(on bool)

Uncover has the pieces added next uncovered: whatever gives way (GiveWay) is left out over them, thinning outwards, where it lies nearer than they do, in a frame with a depth.

func (*Sprites) Uncovers added in v0.22.0

func (s *Sprites) Uncovers() bool

Uncovers reports whether any piece gathered is uncovered, and GivesWay whether any gives way: a source holding both asks for the pass (Frame.DrawUncovered).

func (*Sprites) Wrap

func (s *Sprites) Wrap(w, h float32, x, y bool)

Wrap has the sprites laid over a world w by h that wraps across where x says and down where y does, each where a camera's window sees it.

type Taking

type Taking = compose.Taking

the names of compose's, gfx's and text's the sprites and labels draw with

type Target

type Target = compose.Target

the names of compose's, gfx's and text's the sprites and labels draw with

type Uniforms

type Uniforms = compose.Uniforms

the names of compose's, gfx's and text's the sprites and labels draw with

Jump to

Keyboard shortcuts

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