Documentation ¶
Index ¶
- type AlignHorizontal
- type AlignVertical
- type Cache
- type Canvas
- func (c *Canvas) AddChild(o object)
- func (c *Canvas) Dispose()
- func (c *Canvas) Draw(dst *ebiten.Image)
- func (c *Canvas) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (c *Canvas) IsDisposed() bool
- func (c *Canvas) IsOffscreen() bool
- func (c *Canvas) IsVisible() bool
- func (c *Canvas) SetDstImage(img *ebiten.Image)
- func (c *Canvas) SetOffscreen(offscreen bool)
- func (c *Canvas) SetVisibility(visible bool)
- type ColorScale
- type Container
- func (c *Container) AddChild(o object)
- func (c *Container) Dispose()
- func (c *Container) Draw(dst *ebiten.Image)
- func (c *Container) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (c *Container) IsDisposed() bool
- func (c *Container) IsVisible() bool
- func (c *Container) SetVisibility(visible bool)
- type DrawOptions
- type GrowHorizontal
- type GrowVertical
- type Label
- func (l *Label) BoundsRect() gmath.Rect
- func (l *Label) Dispose()
- func (l *Label) Draw(dst *ebiten.Image)
- func (l *Label) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (l *Label) GetAlignHorizontal() AlignHorizontal
- func (l *Label) GetAlignVertical() AlignVertical
- func (l *Label) GetAlpha() float32
- func (l *Label) GetColorScale() ColorScale
- func (l *Label) GetGrowHorizontal() GrowHorizontal
- func (l *Label) GetGrowVertical() GrowVertical
- func (l *Label) GetSize() (w, h int)
- func (l *Label) IsDisposed() bool
- func (l *Label) IsVisible() bool
- func (l *Label) SetAlignHorizontal(a AlignHorizontal)
- func (l *Label) SetAlignVertical(a AlignVertical)
- func (l *Label) SetAlpha(a float32)
- func (l *Label) SetColorScale(cs ColorScale)
- func (l *Label) SetGrowHorizontal(g GrowHorizontal)
- func (l *Label) SetGrowVertical(g GrowVertical)
- func (l *Label) SetSize(w, h int)
- func (l *Label) SetText(s string)
- func (l *Label) SetVisibility(visible bool)
- type Line
- func (l *Line) BoundsRect() gmath.Rect
- func (l *Line) Dispose()
- func (l *Line) Draw(dst *ebiten.Image)
- func (l *Line) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (l *Line) GetAlpha() float32
- func (l *Line) GetColorScale() ColorScale
- func (l *Line) GetWidth() float64
- func (l *Line) IsDisposed() bool
- func (l *Line) IsVisible() bool
- func (l *Line) SetAlpha(a float32)
- func (l *Line) SetColorScale(cs ColorScale)
- func (l *Line) SetVisibility(visible bool)
- func (l *Line) SetWidth(w float64)
- type Rect
- func (rect *Rect) BoundsRect() gmath.Rect
- func (rect *Rect) Dispose()
- func (rect *Rect) Draw(dst *ebiten.Image)
- func (rect *Rect) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (rect *Rect) GetFillColorScale() ColorScale
- func (rect *Rect) GetHeight() float64
- func (rect *Rect) GetOutlineColorScale() ColorScale
- func (rect *Rect) GetOutlineWidth() float64
- func (rect *Rect) GetWidth() float64
- func (rect *Rect) IsCentered() bool
- func (rect *Rect) IsDisposed() bool
- func (rect *Rect) IsVisible() bool
- func (rect *Rect) SetCentered(centered bool)
- func (rect *Rect) SetFillColorScale(cs ColorScale)
- func (rect *Rect) SetHeight(h float64)
- func (rect *Rect) SetOutlineColorScale(cs ColorScale)
- func (rect *Rect) SetOutlineWidth(w float64)
- func (rect *Rect) SetVisibility(visible bool)
- func (rect *Rect) SetWidth(w float64)
- type Shader
- type Sprite
- func (s *Sprite) BoundsRect() gmath.Rect
- func (s *Sprite) Dispose()
- func (s *Sprite) Draw(dst *ebiten.Image)
- func (s *Sprite) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (s *Sprite) GetAlpha() float32
- func (s *Sprite) GetColorScale() ColorScale
- func (s *Sprite) GetFrameHeight() int
- func (s *Sprite) GetFrameOffsetX() int
- func (s *Sprite) GetFrameOffsetY() int
- func (s *Sprite) GetFrameWidth() int
- func (s *Sprite) GetImage() *ebiten.Image
- func (s *Sprite) GetScaleX() float64
- func (s *Sprite) GetScaleY() float64
- func (s *Sprite) ImageHeight() int
- func (s *Sprite) ImageWidth() int
- func (s *Sprite) IsCentered() bool
- func (s *Sprite) IsDisposed() bool
- func (s *Sprite) IsHorizontallyFlipped() bool
- func (s *Sprite) IsVerticallyFlipped() bool
- func (s *Sprite) IsVisible() bool
- func (s *Sprite) SetAlpha(a float32)
- func (s *Sprite) SetCentered(centered bool)
- func (s *Sprite) SetColorScale(cs ColorScale)
- func (s *Sprite) SetFrameHeight(h int)
- func (s *Sprite) SetFrameOffsetX(x int)
- func (s *Sprite) SetFrameOffsetY(y int)
- func (s *Sprite) SetFrameWidth(w int)
- func (s *Sprite) SetHorizontalFlip(hflip bool)
- func (s *Sprite) SetImage(img *ebiten.Image)
- func (s *Sprite) SetScaleX(scale float64)
- func (s *Sprite) SetScaleY(scale float64)
- func (s *Sprite) SetVerticalFlip(vflip bool)
- func (s *Sprite) SetVisibility(visible bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlignHorizontal ¶
type AlignHorizontal uint8
const ( AlignHorizontalLeft AlignHorizontal = iota AlignHorizontalCenter AlignHorizontalRight )
type AlignVertical ¶
type AlignVertical uint8
const ( AlignVerticalTop AlignVertical = iota AlignVerticalCenter AlignVerticalBottom )
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a storage that is shared between all graphical elements.
Usually, there should be only 1 graphical cache per app.
type Canvas ¶
func (*Canvas) DrawWithOptions ¶
func (c *Canvas) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*Canvas) IsDisposed ¶
func (*Canvas) IsOffscreen ¶
func (*Canvas) SetDstImage ¶
func (c *Canvas) SetDstImage(img *ebiten.Image)
func (*Canvas) SetOffscreen ¶
func (*Canvas) SetVisibility ¶
type ColorScale ¶
ColorScale is like ebiten.ColorScale, but its values don't need to be premultiplied. In a sense, it's like color.NRGBA in comparison with color.RGBA.
For a normal color, we use {1, 1, 1, 1}, for a transparent color it's {0, 0, 0, 0}. To double the amount of red, you can use {2, 1, 1, 1} or {1, 0.5, 0.5, 1}.
Use ColorScaleFromRGBA and ColorScaleFromColor if you want to construct the color scale object easily.
func ColorScaleFromColor ¶
func ColorScaleFromColor(c color.NRGBA) ColorScale
ColorScaleFromRGBA constructs a ColorScale using ColorScale.SetColor method.
func ColorScaleFromRGBA ¶
func ColorScaleFromRGBA(r, g, b, a uint8) ColorScale
ColorScaleFromRGBA constructs a ColorScale using ColorScale.SetRGBA method.
func RGB ¶
func RGB(rgb uint64) ColorScale
RGB returns a ColorScale created from the bits of rgb value. RGB(0xAABBCC) is identical to R=0xAA, G=0xBB, B=0xCC, A=0xFF.
Note: alpha value is fixed to 0xFF, if you need some other value, use RGBA() function instead.
Hint: use RGB(v).Color() to get a color.NRGBA object.
func RGBA ¶
func RGBA(rgb uint64) ColorScale
RGBA returns a ColorScale created from the bits of rgba value. RGBA(0xAABBCCEE) is identical to R=0xAA, G=0xBB, B=0xCC, A=0xEE.
Hint: use RGBA(v).Color() to get a color.NRGBA object.
func (ColorScale) Color ¶
func (c ColorScale) Color() color.NRGBA
Color returns the color.NRGBA representation of a color scale.
It will only work correctly for color scales those values are in [0, 1] range. If some color value overflows (or underflows) this range, the result of this operation is truncated garbage.
This function is mostly useful in combination with RGB() function to construct a color.NRGBA easily: RGB(0xAABBCCEE).Color().
func (ColorScale) RotateHue ¶
func (c ColorScale) RotateHue(deg float32) ColorScale
RotateHue returns a color scale with its hue rotated. The argument specifies the number of degrees to rotate.
func (ColorScale) ScaleAlpha ¶
func (c ColorScale) ScaleAlpha(x float32) ColorScale
ScaleAlpha returns the color scale with alpha multiplied by x. It doesn't affect R/G/B channels.
func (ColorScale) ScaleRGB ¶
func (c ColorScale) ScaleRGB(x float32) ColorScale
ScaleRGB multiplies R, G and B color scale components by x. It doesn't affect the alpha channel.
func (*ColorScale) SetColor ¶
func (c *ColorScale) SetColor(rgba color.NRGBA)
SetColor assigns the color.NRGBA equivalent to a color scale.
func (*ColorScale) SetRGBA ¶
func (c *ColorScale) SetRGBA(r, g, b, a uint8)
SetRGBA is like SetColor, but accepts every color part separately.
type Container ¶
type Container struct { Pos gmath.Pos Rotation *gmath.Rad // contains filtered or unexported fields }
func NewContainer ¶
func NewContainer() *Container
func (*Container) DrawWithOptions ¶
func (c *Container) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*Container) IsDisposed ¶
func (*Container) IsVisible ¶
IsVisible reports whether this container is visible. Use SetVisibility to change this flag value.
If container is invisible, none of its objects will be rendered during the Draw call.
func (*Container) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the container. Use IsVisible to get the current flag value.
type GrowHorizontal ¶
type GrowHorizontal uint8
const ( GrowHorizontalRight GrowHorizontal = iota GrowHorizontalLeft GrowHorizontalBoth GrowHorizontalNone )
type GrowVertical ¶
type GrowVertical uint8
const ( GrowVerticalDown GrowVertical = iota GrowVerticalUp GrowVerticalBoth GrowVerticalNone )
type Label ¶
Label is a simple text rendering object.
It supports different kinds of grow/aling settings. The text color can be changed, but only for the whole text.
Label implements gscene Graphics interface.
func (*Label) BoundsRect ¶
func (*Label) DrawWithOptions ¶
func (l *Label) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*Label) GetAlignHorizontal ¶
func (l *Label) GetAlignHorizontal() AlignHorizontal
func (*Label) GetAlignVertical ¶
func (l *Label) GetAlignVertical() AlignVertical
func (*Label) GetAlpha ¶
GetAlpha is a shorthand for GetColorScale().A expression. It's mostly provided for a symmetry with SetAlpha.
func (*Label) GetColorScale ¶
func (l *Label) GetColorScale() ColorScale
GetColorScale is used to retrieve the current color scale value of the label's text. Use SetColorScale to change it.
func (*Label) GetGrowHorizontal ¶
func (l *Label) GetGrowHorizontal() GrowHorizontal
func (*Label) GetGrowVertical ¶
func (l *Label) GetGrowVertical() GrowVertical
func (*Label) IsDisposed ¶
func (*Label) SetAlignHorizontal ¶
func (l *Label) SetAlignHorizontal(a AlignHorizontal)
func (*Label) SetAlignVertical ¶
func (l *Label) SetAlignVertical(a AlignVertical)
func (*Label) SetColorScale ¶
func (l *Label) SetColorScale(cs ColorScale)
SetColorScale assigns a new ColorScale to this label's text. Use GetColorScale to retrieve the current color scale.
func (*Label) SetGrowHorizontal ¶
func (l *Label) SetGrowHorizontal(g GrowHorizontal)
func (*Label) SetGrowVertical ¶
func (l *Label) SetGrowVertical(g GrowVertical)
func (*Label) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the label. Use IsVisible to get the current flag value.
type Line ¶
Line is a simple 2-point line graphical primitive. Its color and width can be configured.
func NewLine ¶
NewLine returns a line that is drawn from begin pos to end pos. BeginPos and EndPos fields can be changed directly.
By default, a line has these properties: * Visible=true * The ColorScale is {1, 1, 1, 1} * Width is 1
func (*Line) BoundsRect ¶
BoundsRect returns a rectangle that fully contains the line.
This is useful when trying to calculate whether this object is contained inside some area or not (like a camera view area).
func (*Line) Dispose ¶
func (l *Line) Dispose()
Dispose marks this line for deletion. After calling this method, IsDisposed will report true.
func (*Line) Draw ¶
func (l *Line) Draw(dst *ebiten.Image)
Draw renders the line onto the provided dst image.
This method is a shorthand to DrawWithOptions(dst, {}) which also implements the gscene.Graphics interface.
See DrawWithOptions for more info.
func (*Line) DrawWithOptions ¶
func (l *Line) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
DrawWithOptions renders the line onto the provided dst image while also using the extra provided offset and other options.
The offset is applied to both begin and end positions.
func (*Line) GetAlpha ¶
GetAlpha is a shorthand for GetColorScale().A expression. It's mostly provided for a symmetry with SetAlpha.
func (*Line) GetColorScale ¶
func (l *Line) GetColorScale() ColorScale
GetColorScale is used to retrieve the current color scale value of the line. Use SetColorScale to change it.
func (*Line) IsDisposed ¶
IsDisposed reports whether this line is marked for deletion. IsDisposed returns true only after Disposed was called on this line.
func (*Line) IsVisible ¶
IsVisible reports whether this line is visible. Use SetVisibility to change this flag value.
When line is invisible (visible=false), it will not be rendered at all. This is an efficient way to temporarily hide a line.
func (*Line) SetColorScale ¶
func (l *Line) SetColorScale(cs ColorScale)
SetColorScale assigns a new ColorScale to this line. Use GetColorScale to retrieve the current color scale.
func (*Line) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the line. Use IsVisible to get the current flag value.
type Rect ¶
type Rect struct { // Pos is a rect location binder. // See Pos documentation to learn how it works. // // When rendering an image, Pos.Resolve() will be used // to calculate the final position. Pos gmath.Pos // contains filtered or unexported fields }
Rect is a rectangle graphical primitive.
Depending on the configuration, it's one of these:
- Fill-only rectangle
- Outline-only rectangle
- Fill+outline rectangle
If you need a "texture rect", use a sprite instead.
func NewRect ¶
NewRect returns a rectangle of the specified size. Use SetSize if you need to resize it afterwards.
By default, a rect has these properties: * Centered=true * Visible=true * The FillColorScale is {1, 1, 1, 1} * The OutlineColorScale is {0, 0, 0, 0} (invisible) * OutlineWidth is 1 (but the default outline color is invisible)
func (*Rect) BoundsRect ¶
BoundsRect returns the properly positioned rectangle.
This is useful when trying to calculate whether this object is contained inside some area or not (like a camera view area).
func (*Rect) Dispose ¶
func (rect *Rect) Dispose()
Dispose marks this rect for deletion. After calling this method, IsDisposed will report true.
func (*Rect) Draw ¶
func (rect *Rect) Draw(dst *ebiten.Image)
Draw renders the rect onto the provided dst image.
This method is a shorthand to DrawWithOptions(dst, {}) which also implements the gscene.Graphics interface.
See DrawWithOptions for more info.
func (*Rect) DrawWithOptions ¶
func (rect *Rect) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
DrawWithOptions renders the rect onto the provided dst image while also using the extra provided offset.
func (*Rect) GetFillColorScale ¶
func (rect *Rect) GetFillColorScale() ColorScale
GetFillColorScale is used to retrieve the current fill color scale value of the rect. Use SetFillColorScale to change it.
func (*Rect) GetOutlineColorScale ¶
func (rect *Rect) GetOutlineColorScale() ColorScale
GetOutlineColorScale is used to retrieve the current outline color scale value of the rect. Use SetOutlineColorScale to change it.
func (*Rect) GetOutlineWidth ¶
GetOutlineWidth reports the current outline width. Use SetOutlineWidth to change it.
func (*Rect) IsCentered ¶
IsCentered reports whether Centered flag is set. Use SetCentered to change this flag value.
When rect is centered, its image origin will be {w/2, h/2} during rendering.
func (*Rect) IsDisposed ¶
IsDisposed reports whether this rect is marked for deletion. IsDisposed returns true only after Disposed was called on this rect.
func (*Rect) IsVisible ¶
IsVisible reports whether this rect is visible. Use SetVisibility to change this flag value.
When rect is invisible (visible=false), it will not be rendered at all. This is an efficient way to temporarily hide a rect.
func (*Rect) SetCentered ¶
SetCentered changes the Centered flag value. Use IsCentered to get the current flag value.
func (*Rect) SetFillColorScale ¶
func (rect *Rect) SetFillColorScale(cs ColorScale)
SetFillColorScale assigns a new fill ColorScale to this rect. Use GetFillColorScale to retrieve the current color scale.
func (*Rect) SetOutlineColorScale ¶
func (rect *Rect) SetOutlineColorScale(cs ColorScale)
SetOutlineColorScale assigns a new outline ColorScale to this rect. Use GetOutlineColorScale to retrieve the current color scale.
func (*Rect) SetOutlineWidth ¶
SetOutlineWidth changes the rect outline width. Use GetOutlineWidth to retrieve the current outline width value.
func (*Rect) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the rect. Use IsVisible to get the current flag value.
type Shader ¶
type Shader struct { // Enabled reports whether this shader will be used during the rendering. Enabled bool Texture1 *ebiten.Image Texture2 *ebiten.Image Texture3 *ebiten.Image // contains filtered or unexported fields }
Shader is an ebiten.Shader wrapper compatible with types provided by the graphics package.
Shader allocates its uniforms map lazily.
func NewShader ¶
func NewShader(compiled *ebiten.Shader) *Shader
NewShader returns a shader wrapper. The returned shader has Enabled flag set to true.
Use Shader object fields to configure it.
func (*Shader) Clone ¶
Clone returns a cloned shader object. It's main purpose is to create a new shader handle that has the identical uniform values those can be modified independently.
func (*Shader) SetFloatValue ¶
SetFloatValue assigns float Kage uniform variable.
func (*Shader) SetIntValue ¶
SetIntValue assigns int Kage uniform variable. Since Kage uniforms are 32-bits, we use int32 here to avoid overflows.
func (*Shader) SetVec2Value ¶
SetVec2Value assigns vec2 Kage uniform variable. v must be a 2-element slice, otherwise this method will panic.
func (*Shader) SetVec3Value ¶
SetVec3Value assigns vec3 Kage uniform variable. v must be a 3-element slice, otherwise this method will panic.
type Sprite ¶
type Sprite struct { // Pos is a sprite location binder. // See Pos documentation to learn how it works. // // When rendering an image, Pos.Resolve() will be used // to calculate the final position. Pos gmath.Pos // Rotation is a sprite rotation binder. // It's expected that sprite's rotation depends on // some other object rotation, hence the pointer. Rotation *gmath.Rad // Shader is an shader that will be used during rendering of the image. // Use NewShader to initialize this field. // // If nil, no shaders will be used. Shader *Shader // contains filtered or unexported fields }
Sprite is a feature-rich ebiten.Image wrapper.
Sprites make many operations over the image easier. It also tries to avoid some performance pitfalls related to some edge cases of Ebitengine.
Sprite implements gscene Graphics interface.
func NewSprite ¶
NewSprite returns an empty sprite. Use SetImage method to assign a texture to it.
By default, a sprite has these properties: * Centered=true * Visible=true * ScaleX and ScaleY are 1 * The ColorScale is {1, 1, 1, 1}
func (*Sprite) BoundsRect ¶
BoundsRect returns the properly positioned image containing rectangle.
This is useful when trying to calculate whether this sprite is contained inside some area or not (like a camera view area).
The bounding rectangle can't be used for collisions since it treats the frame size as an object size.
func (*Sprite) Dispose ¶
func (s *Sprite) Dispose()
Dispose marks this sprite for deletion. After calling this method, IsDisposed will report true.
Note that it's up to the scene to actually detach this sprite. This method only sets a flag but doesn't delete anything.
func (*Sprite) Draw ¶
func (s *Sprite) Draw(dst *ebiten.Image)
Draw renders the associated image onto the provided dst image.
This method is a shorthand to DrawWithOptions(dst, {}) which also implements the gscene.Graphics interface.
See DrawWithOptions for more info.
func (*Sprite) DrawWithOptions ¶
func (s *Sprite) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
DrawWithOptions renders the associated image onto the provided dst image while also using the extra provided offset.
func (*Sprite) GetAlpha ¶
GetAlpha is a shorthand for GetColorScale().A expression. It's mostly provided for a symmetry with SetAlpha.
func (*Sprite) GetColorScale ¶
func (s *Sprite) GetColorScale() ColorScale
GetColorScale is used to retrieve the current color scale value of the sprite. Use SetColorScale to change it.
func (*Sprite) GetFrameHeight ¶
GetFrameHeight returns the current frame height. Use SetFrameHeight to change it.
func (*Sprite) GetFrameOffsetX ¶
GetFrameOffsetX returns the currently configured frame offset X. Use SetFrameOffsetX to change it.
func (*Sprite) GetFrameOffsetY ¶
GetFrameOffsetY returns the currently configured frame offset Y. Use SetFrameOffsetY to change it.
func (*Sprite) GetFrameWidth ¶
GetFrameWidth returns the current frame width. Use SetFrameWidth to change it.
func (*Sprite) GetImage ¶
func (s *Sprite) GetImage() *ebiten.Image
GetImage returns the sprite's current texture image.
func (*Sprite) GetScaleX ¶
GetScaleX returns the sprite horizontal (X-axis) scaling factor. Use SetScaleX to change it.
func (*Sprite) GetScaleY ¶
GetScaleY returns the sprite vertical (Y-axis) scaling factor. Use SetScaleY to change it.
func (*Sprite) ImageHeight ¶
ImageHeight returns the bound image height. The image size (width/height) can't be changed, unless a new image is assigned to the sprite.
func (*Sprite) ImageWidth ¶
ImageWidth returns the bound image width. The image size (width/height) can't be changed, unless a new image is assigned to the sprite.
func (*Sprite) IsCentered ¶
IsCentered reports whether Centered flag is set. Use SetCentered to change this flag value.
When sprite is centered, its image origin will be {w/2, h/2} during rendering. It also makes the sprite properly rotate around that origin point.
func (*Sprite) IsDisposed ¶
IsDisposed reports whether this sprite is marked for deletion. IsDisposed returns true only after Disposed was called on this sprite.
func (*Sprite) IsHorizontallyFlipped ¶
IsHorizontallyFlipped reports whether HorizontalFlip flag is set. Use SetHorizontalFlip to change this flag value.
When sprite is horizontally flipped, it's image will be mirrored horizontally.
func (*Sprite) IsVerticallyFlipped ¶
IsVerticallyFlipped reports whether VerticalFlip flag is set. Use SetVerticalFlip to change this flag value.
When sprite is vertically flipped, it's image will be mirrored vertically.
func (*Sprite) IsVisible ¶
IsVisible reports whether this sprite is visible. Use SetVisibility to change this flag value.
When sprite is invisible (visible=false), its image will not be rendered at all. This is an efficient way to temporarily hide a sprite.
func (*Sprite) SetCentered ¶
SetCentered changes the Centered flag value. Use IsCentered to get the current flag value.
func (*Sprite) SetColorScale ¶
func (s *Sprite) SetColorScale(cs ColorScale)
SetColorScale assigns a new ColorScale to this sprite. Use GetColorScale to retrieve the current color scale.
func (*Sprite) SetFrameHeight ¶
SetFrameHeight assigns new frame height. Use GetFrameHeight to retrieve the current value.
The frame sizes are useful when working with an underlying image that contains several logical images ("frames"). A frame size defines an image rectangle sizes to be used. A frame offset defines the rectangle Min value.
func (*Sprite) SetFrameOffsetX ¶
SetFrameOffsetX assigns new frame X offset. Use GetFrameOffsetX to retrieve the current offset values.
The frame offsets are useful when working with an underlying image that contains several logical images ("frames"). A frame offset defines the rectangle Min value. A frame size defines an image rectangle sizes to be used.
func (*Sprite) SetFrameOffsetY ¶
SetFrameOffsetY assigns new frame Y offset. Use GetFrameOffsetY to retrieve the current offset values.
The frame offsets are useful when working with an underlying image that contains several logical images ("frames"). A frame offset defines the rectangle Min value. A frame size defines an image rectangle sizes to be used.
func (*Sprite) SetFrameWidth ¶
SetFrameWidth assigns new frame width. Use GetFrameWidth to retrieve the current value.
The frame sizes are useful when working with an underlying image that contains several logical images ("frames"). A frame size defines an image rectangle sizes to be used. A frame offset defines the rectangle Min value.
func (*Sprite) SetHorizontalFlip ¶
SetHorizontalFlip changes the HorizontalFlip flag value. Use IsHorizontallyFlipped to get the current flag value.
func (*Sprite) SetImage ¶
func (s *Sprite) SetImage(img *ebiten.Image)
SetImage changes the image associated with a sprite.
Assigning an image sets the frame offsets to {0, 0}. The default frame width/height are image sizes.
func (*Sprite) SetScaleX ¶
SetScaleX assigns new sprite horizontal (X-axis) scaling factor. Use GetScaleX to retrieve the current value.
func (*Sprite) SetScaleY ¶
SetScaleY assigns new sprite vertical (Y-axis) scaling factor. Use GetScaleY to retrieve the current value.
func (*Sprite) SetVerticalFlip ¶
SetVerticalFlip changes the VerticalFlip flag value. Use IsVerticallyFlipped to get the current flag value.
func (*Sprite) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the sprite. Use IsVisible to get the current flag value.