Documentation
¶
Index ¶
- Variables
- func Clamp01(v float64) float64
- func ColorFieldPtrs(c *Color) (r, g, b, a *float64)
- func Lerp(a, b, t float64) float64
- func Lerp32(a, b, t float32) float32
- func TweenEase(cfg TweenConfig) ease.TweenFunc
- type BlendMode
- type CacheTreeMode
- type Color
- type EventType
- type HitShape
- type KeyModifiers
- type MouseButton
- type NodeType
- type Range
- type Rect
- type TextAlign
- type TextureRegion
- type TweenConfig
- type Vec2
Constants ¶
This section is empty.
Variables ¶
var ColorBlack = Color{0, 0, 0, 1}
ColorBlack is opaque black.
var ColorTransparent = Color{0, 0, 0, 0}
ColorTransparent is fully transparent black.
var ColorWhite = Color{1, 1, 1, 1}
ColorWhite is the default tint (no color modification).
Functions ¶
func ColorFieldPtrs ¶
ColorFieldPtrs returns pointers to the individual color component fields. Used by tween code that needs to mutate color fields via pointer.
func TweenEase ¶
func TweenEase(cfg TweenConfig) ease.TweenFunc
TweenEase returns cfg.Ease if non-nil, otherwise ease.Linear.
Types ¶
type BlendMode ¶
type BlendMode uint8
BlendMode selects a compositing operation. Each maps to a specific ebiten.Blend value.
const ( BlendNormal BlendMode = iota // source-over (standard alpha blending) BlendAdd // additive / lighter BlendMultiply // multiply (source * destination; only darkens) BlendScreen // screen (1 - (1-src)*(1-dst); only brightens) BlendErase // destination-out (punch transparent holes) BlendMask // clip destination to source alpha BlendBelow // destination-over (draw behind existing content) BlendNone // opaque copy (skip blending) )
func (BlendMode) EbitenBlend ¶
EbitenBlend returns the ebiten.Blend value corresponding to this BlendMode.
type CacheTreeMode ¶
type CacheTreeMode uint8
CacheTreeMode controls how a cached subtree invalidates.
const ( // CacheTreeManual requires the user to call InvalidateCacheTree() when // the subtree changes. Zero overhead on setters. Best for large tilemaps. CacheTreeManual CacheTreeMode = iota + 1 // CacheTreeAuto automatically invalidates when any setter is called on // the cached node or its descendants. Small overhead per setter call // (one pointer chase + bool write). CacheTreeAuto )
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
Color represents an RGBA color with components in [0, 1]. Not premultiplied. Premultiplication occurs at render submission time.
Use RGB or RGBA to construct colors. RGB defaults alpha to 1 (fully opaque), eliminating the common mistake of forgetting alpha.
func ColorFromHSV ¶
ColorFromHSV creates a Color from HSV values, all in [0, 1]. Hue wraps (0 and 1 are both red), saturation 0 is grayscale, value 0 is black.
func ColorFromRGBA ¶
ColorFromRGBA creates a Color from 8-bit RGBA components (0–255). The returned Color is non-premultiplied with components in [0, 1].
func RGB ¶
RGB creates an opaque Color from red, green, blue components in [0, 1]. Alpha is set to 1 (fully opaque).
type EventType ¶
type EventType uint8
EventType identifies a kind of interaction event.
const ( EventPointerDown EventType = iota // fires when a pointer button is pressed EventPointerUp // fires when a pointer button is released EventPointerMove // fires when the pointer moves (hover, no button) EventClick // fires on press then release over the same node EventDragStart // fires when movement exceeds the drag dead zone EventDrag // fires each frame while dragging EventDragEnd // fires when the pointer is released after dragging EventPinch // fires during a two-finger pinch/rotate gesture EventPointerEnter // fires when the pointer enters a node's bounds EventPointerLeave // fires when the pointer leaves a node's bounds EventBgClick // internal: background click (no node hit) )
type HitShape ¶
type HitShape interface {
// Contains reports whether the local-space point (x, y) is inside the shape.
Contains(x, y float64) bool
}
HitShape is implemented by custom hit-test shapes attached to a Node.
type KeyModifiers ¶
type KeyModifiers uint8
KeyModifiers is a bitmask of keyboard modifier keys. Values can be combined with bitwise OR (e.g. ModShift | ModCtrl).
const ( ModShift KeyModifiers = 1 << iota // Shift key ModCtrl // Control key ModAlt // Alt / Option key ModMeta // Meta / Command / Windows key )
type MouseButton ¶
type MouseButton uint8
MouseButton identifies a mouse button.
const ( MouseButtonLeft MouseButton = iota // primary (left) mouse button MouseButtonRight // secondary (right) mouse button MouseButtonMiddle // middle mouse button (scroll wheel click) )
type NodeType ¶
type NodeType uint8
NodeType distinguishes rendering behavior for a Node.
const ( NodeTypeContainer NodeType = iota // group node with no visual output NodeTypeSprite // renders a TextureRegion or custom image NodeTypeMesh // renders arbitrary triangles via DrawTriangles NodeTypeParticleEmitter // CPU-simulated particle system NodeTypeText // renders text via DistanceFieldFont )
type Range ¶
type Range struct {
Min, Max float64
}
Range is a general-purpose min/max range. Used by the particle system (EmitterConfig) and potentially other systems.
type Rect ¶
type Rect struct {
X, Y, Width, Height float64
}
Rect is an axis-aligned rectangle. The coordinate system has its origin at the top-left, with Y increasing downward.
func (Rect) Contains ¶
Contains reports whether the point (x, y) lies inside the rectangle. Points on the edge are considered inside.
func (Rect) Intersects ¶
Intersects reports whether r and other overlap. Adjacent rectangles (sharing only an edge) are considered intersecting.
type TextAlign ¶
type TextAlign uint8
TextAlign controls horizontal text alignment within a TextBlock.
type TextureRegion ¶
type TextureRegion struct {
Page uint16 // atlas page index (references Scene.pages)
X, Y uint16 // top-left corner of the sub-image rect within the atlas page
Width uint16 // width of the sub-image rect (may differ from OriginalW if trimmed)
Height uint16 // height of the sub-image rect (may differ from OriginalH if trimmed)
OriginalW uint16 // untrimmed sprite width as authored
OriginalH uint16 // untrimmed sprite height as authored
OffsetX int16 // horizontal trim offset from TexturePacker
OffsetY int16 // vertical trim offset from TexturePacker
Rotated bool // true if the region is stored 90 degrees clockwise in the atlas
}
TextureRegion describes a sub-rectangle within an atlas page. Value type (32 bytes) — stored directly on Node, no pointer.
type TweenConfig ¶
type TweenConfig struct {
Duration float32 // seconds; 0 = instant
Ease ease.TweenFunc // nil defaults to ease.Linear
}
TweenConfig holds the duration and easing function for a tween. A nil Ease defaults to ease.Linear. Duration is in seconds; 0 means instant.