Documentation ¶
Index ¶
- func CompileShaders()
- func FormatRGB(clr color.NRGBA) string
- func FormatRGBA(clr color.NRGBA) string
- type AlignHorizontal
- type AlignVertical
- type Camera
- func (c *Camera) GetBounds() gmath.Rect
- func (c *Camera) GetCenterOffset() gmath.Vec
- func (c *Camera) GetLayerMask() uint64
- func (c *Camera) GetOffset() gmath.Vec
- func (c *Camera) GetScale() float64
- func (c *Camera) GetScaledViewportRect() gmath.Rect
- func (c *Camera) GetViewportRect() gmath.Rect
- func (c *Camera) Pan(delta gmath.Vec) bool
- func (c *Camera) SetBounds(bounds gmath.Rect)
- func (c *Camera) SetCenterOffset(pos gmath.Vec) bool
- func (c *Camera) SetLayerMask(mask uint64)
- func (c *Camera) SetOffset(pos gmath.Vec) bool
- func (c *Camera) SetScale(scale float64)
- func (c *Camera) SetViewportRect(rect gmath.Rect)
- func (c *Camera) ToScreenPos(worldPos gmath.Vec) gmath.Vec
- func (c *Camera) ToWorldPos(screenPos gmath.Vec) gmath.Vec
- type Canvas
- func (c *Canvas) AddChild(o DisposableObject)
- 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 Circle
- func (c *Circle) BoundsRect() gmath.Rect
- func (c *Circle) Dispose()
- func (c *Circle) Draw(dst *ebiten.Image)
- func (c *Circle) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (c *Circle) GetFillColorScale() ColorScale
- func (c *Circle) GetFillOffset() float64
- func (c *Circle) GetOutlineColorScale() ColorScale
- func (c *Circle) GetOutlineDash() (length, gap float64)
- func (c *Circle) GetOutlineWidth() float64
- func (c *Circle) GetRadius() float64
- func (c *Circle) IsCentered() bool
- func (c *Circle) IsDisposed() bool
- func (c *Circle) IsVisible() bool
- func (c *Circle) SetCentered(centered bool)
- func (c *Circle) SetFillColorScale(cs ColorScale)
- func (c *Circle) SetFillOffset(offset float64)
- func (c *Circle) SetOutlineColorScale(cs ColorScale)
- func (c *Circle) SetOutlineDash(length, gap float64)
- func (c *Circle) SetOutlineWidth(w float64)
- func (c *Circle) SetRadius(r float64)
- func (c *Circle) SetVisibility(visible bool)
- type ColorScale
- func (c *ColorScale) AsVec3() []float32
- func (c *ColorScale) AsVec4() []float32
- func (c ColorScale) Color() color.NRGBA
- func (c ColorScale) Lerp(target ColorScale, t float32) ColorScale
- func (c ColorScale) Mul(other ColorScale) ColorScale
- func (c ColorScale) RotateHue(deg float32) ColorScale
- func (c ColorScale) ScaleAlpha(x float32) ColorScale
- func (c ColorScale) ScaleRGB(x float32) ColorScale
- func (c *ColorScale) SetColor(rgba color.NRGBA)
- func (c *ColorScale) SetRGBA(r, g, b, a uint8)
- func (c ColorScale) String() string
- func (c *ColorScale) ToEbitenColorScale() ebiten.ColorScale
- func (c ColorScale) ToHSL() (h, s, l float32)
- type Container
- func (c *Container) AddChild(o DisposableObject)
- 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 DisposableObject
- type DottedLine
- func (l *DottedLine) BoundsRect() gmath.Rect
- func (l *DottedLine) Dispose()
- func (l *DottedLine) Draw(dst *ebiten.Image)
- func (l *DottedLine) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (l *DottedLine) GetAlpha() float32
- func (l *DottedLine) GetColorScale() ColorScale
- func (l *DottedLine) GetDotRadius() float64
- func (l *DottedLine) GetDotSpacing() float64
- func (l *DottedLine) IsDisposed() bool
- func (l *DottedLine) IsVisible() bool
- func (l *DottedLine) SetAlpha(a float32)
- func (l *DottedLine) SetColorScale(cs ColorScale)
- func (l *DottedLine) SetDotRadius(r float64)
- func (l *DottedLine) SetDotSpacing(spacing float64)
- func (l *DottedLine) 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) SetShadow(cs ColorScale)
- func (l *Label) SetSize(w, h int)
- func (l *Label) SetText(s string)
- func (l *Label) SetVisibility(visible bool)
- type Layer
- 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 Object
- 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 SceneDrawer
- type SceneLayerDrawer
- type Shader
- func (s *Shader) Clone() *Shader
- func (s *Shader) GetValue(key string) any
- func (s *Shader) SetFloatValue(key string, v float32)
- func (s *Shader) SetIntValue(key string, v int32)
- func (s *Shader) SetVec2Value(key string, v []float32)
- func (s *Shader) SetVec3Value(key string, v []float32)
- func (s *Shader) SetVec4Value(key string, v []float32)
- type ShaderObject
- func (o *ShaderObject) Dispose()
- func (o *ShaderObject) Draw(dst *ebiten.Image)
- func (o *ShaderObject) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (o *ShaderObject) GetHeight() int
- func (o *ShaderObject) GetWidth() int
- func (o *ShaderObject) IsDisposed() bool
- func (o *ShaderObject) IsVisible() bool
- func (o *ShaderObject) SetHeight(h int)
- func (o *ShaderObject) SetVisibility(visible bool)
- func (o *ShaderObject) SetWidth(w int)
- 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)
- type StaticLayer
- type TextureLine
- func (l *TextureLine) BoundsRect() gmath.Rect
- func (l *TextureLine) Dispose()
- func (l *TextureLine) Draw(dst *ebiten.Image)
- func (l *TextureLine) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
- func (l *TextureLine) GetAlpha() float32
- func (l *TextureLine) GetColorScale() ColorScale
- func (l *TextureLine) GetTexture() *ebiten.Image
- func (l *TextureLine) IsDisposed() bool
- func (l *TextureLine) IsVisible() bool
- func (l *TextureLine) SetAlpha(a float32)
- func (l *TextureLine) SetColorScale(cs ColorScale)
- func (l *TextureLine) SetTexture(texture *ebiten.Image)
- func (l *TextureLine) SetVisibility(visible bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileShaders ¶
func CompileShaders()
CompileShaders prepares shaders bundled with this package. It should be called once if any of the shader-dependend objects are being used.
Objects that require shaders so far: * Circle * DottedLine
func FormatRGBA ¶
Types ¶
type AlignHorizontal ¶
type AlignHorizontal uint8
const ( AlignHorizontalLeft AlignHorizontal = iota AlignHorizontalCenter AlignHorizontalRight )
type AlignVertical ¶
type AlignVertical uint8
const ( AlignVerticalTop AlignVertical = iota AlignVerticalCenter AlignVerticalBottom )
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera implements a 2D camera for the SceneDrawer.
It's pretty barebones, you might want to wrap it into your game's camera type and add functionality like lerping between A and B. Add Camera itself into the SceneDrawer and put it inside your own camera implementation. Then call appropriate things like [SetOffset] and [Pan] on the wrapped camera to implement something fancier.
Some terminology: * screen coordinates - min=(0,0) max=(windowWidth,windowHeight) * world coordinates - arbitrary values that spefify the object's location inside the game world
Let's assume there is a world coordinate {32, 32}; if the camera's offset is {0, 0}, then screen coordinate is {32, 32}, if the camera's offset is {32, 32}, then screen coordinate is {0, 0}.
Converting coordinates: * screen to world: screenPos.Add(camera.GetOffset()) * world to screen: worldPos.Sub(camera.GetOffset())
Pay attention to the docs, they should tell you which kind of a position is expected for an argument and/or method's return value.
func NewCamera ¶
func NewCamera() *Camera
NewCamera creates a new camera for the SceneDrawer.
It covers the entire screen by default. Use [SetViewportRect] to change that.
The camera has no bounds by default, use [SetBounds] to set panning limits.
It's advised to only call this function after Ebitengine game has already started.
func (*Camera) GetCenterOffset ¶
GetCenterOffset returns the camera current offset translated to the scaled viewport rect's center. To get the untranslated position, use [GetOffset].
The returned pos is in world coordinates.
func (*Camera) GetLayerMask ¶
GetLayerMask returns the current camera's layer bitmask. See [SetLayerMask] doc comment to learn more about the bitmask.
func (*Camera) GetOffset ¶
GetOffset returns the camera current offset. The pos is given for the top-left corner of the camera's scaled viewport rect. To get the center position, use [GetCenterOffset].
The returned pos is in world coordinates.
func (*Camera) GetScaledViewportRect ¶
GetScaledViewportRect returns the camera's rendering rectangle with scaling applied to it.
This rectangle is in screen coordinates, meaning it is unaffected by the camera pos.
func (*Camera) GetViewportRect ¶
GetViewportRect returns the camera's rendering rectangle.
This rectangle is in screen coordinates, meaning it is unaffected by the camera pos.
func (*Camera) Pan ¶
Pan adds the specified camera position delta to the camera's current offset. It's a shorthand to c.SetOffset(c.GetOffset().Add(delta)). The same clamping rules apply as in [SetOffset].
The return value reports whether the position was actually updated.
func (*Camera) SetBounds ¶
SetBounds sets the camera panning limits.
The provided rectangle should not be smaller than camera's world size (in the simplest case, bounds=worldSize). An exception from this rule is zero rect: a zero-value rectangle means "unbound" camera that can go anywhere.
func (*Camera) SetCenterOffset ¶
SetCenterOffset centers the camera around given position. After the clamping rules apply, the pos may end up not being in the perfect center of the camera's scaled viewport rect.
The return value reports whether the position was actually updated.
The pos parameter should be in world coordinates.
func (*Camera) SetLayerMask ¶
SetLayerMask updates the camera's layer bitmask.
The nth bit of the mask controls whether nth layer should be rendered onto the camera. By default, the camera layermask is "all ones", meaning all layers are rendered.
This mask is useful when you want to draw some layers only to particular cameras. For the simplest kinds of games this feature is not needed and you may leave it as is.
This bitmask can affect up to first 64 layers, any other layer is always enabled.
func (*Camera) SetOffset ¶
SetOffset assigns a new offset to the camera. It will be clamped to fit the camera bounds.
The return value reports whether the position was actually updated.
The pos parameter should be in world coordinates.
func (*Camera) SetViewportRect ¶
SetViewportRect changes the camera's viewport area to render to.
The rect is in screen coordinates.
type Canvas ¶
func (*Canvas) AddChild ¶
func (c *Canvas) AddChild(o DisposableObject)
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 Circle ¶
TODO: separate into Circle and DashedCircle.
func NewCircle ¶
NewCircle returns a circle of the specified radius. Use SetRadius if you need to resize it afterwards.
By default, a circle has these properties: * Centered=true * Visible=true * The FillColorScale is {0, 0, 0, 0} (invisible) * FillOffset is 0 (no gaps) * The OutlineColorScale is {1, 1, 1, 1} * OutlineWidth is 1
The outline can have a dashed style.
You need to call CompileShaders before using circles.
func (*Circle) BoundsRect ¶
BoundsRect returns the properly positioned circle containing rectangle.
This is useful when trying to calculate whether this object is contained inside some area or not (like a camera view area).
func (*Circle) Dispose ¶
func (c *Circle) Dispose()
Dispose marks this circle for deletion. After calling this method, IsDisposed will report true.
func (*Circle) Draw ¶
func (c *Circle) Draw(dst *ebiten.Image)
Draw renders the circle 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 (*Circle) DrawWithOptions ¶
func (c *Circle) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*Circle) GetFillColorScale ¶
func (c *Circle) GetFillColorScale() ColorScale
GetFillColorScale is used to retrieve the current fill color scale value of the circle. Use SetFillColorScale to change it.
func (*Circle) GetFillOffset ¶
func (*Circle) GetOutlineColorScale ¶
func (c *Circle) GetOutlineColorScale() ColorScale
GetOutlineColorScale is used to retrieve the current outline color scale value of the circle. Use SetOutlineColorScale to change it.
func (*Circle) GetOutlineDash ¶
func (*Circle) GetOutlineWidth ¶
func (*Circle) IsCentered ¶
IsCentered reports whether Centered flag is set. Use SetCentered to change this flag value.
func (*Circle) IsDisposed ¶
IsDisposed reports whether this circle is marked for deletion. IsDisposed returns true only after Disposed was called on this circle.
func (*Circle) IsVisible ¶
IsVisible reports whether this circle is visible. Use SetVisibility to change this flag value.
When circle is invisible (visible=false), it will not be rendered at all. This is an efficient way to temporarily hide a circle.
func (*Circle) SetCentered ¶
SetCentered changes the Centered flag value. Use IsCentered to get the current flag value.
func (*Circle) SetFillColorScale ¶
func (c *Circle) SetFillColorScale(cs ColorScale)
SetFillColorScale assigns a new fill ColorScale to this circle. Use GetFillColorScale to retrieve the current color scale.
func (*Circle) SetFillOffset ¶
func (*Circle) SetOutlineColorScale ¶
func (c *Circle) SetOutlineColorScale(cs ColorScale)
SetOutlineColorScale assigns a new outline ColorScale to this circle. Use GetOutlineColorScale to retrieve the current color scale.
func (*Circle) SetOutlineDash ¶
func (*Circle) SetOutlineWidth ¶
func (*Circle) SetVisibility ¶
SetVisibility changes the Visible flag value. It can be used to show or hide the circle. Use IsVisible to get the current flag value.
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) AsVec3 ¶
func (c *ColorScale) AsVec3() []float32
AsVec3 returns a color scale as RGB slice (vec3 for shaders).
func (*ColorScale) AsVec4 ¶
func (c *ColorScale) AsVec4() []float32
AsVec4returns a color scale as RGBA slice (vec4 for shaders).
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) Lerp ¶
func (c ColorScale) Lerp(target ColorScale, t float32) ColorScale
func (ColorScale) Mul ¶
func (c ColorScale) Mul(other ColorScale) ColorScale
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.
func (ColorScale) String ¶
func (c ColorScale) String() string
func (*ColorScale) ToEbitenColorScale ¶
func (c *ColorScale) ToEbitenColorScale() ebiten.ColorScale
func (ColorScale) ToHSL ¶
func (c ColorScale) ToHSL() (h, s, l float32)
type Container ¶
type Container struct { Pos gmath.Pos Rotation *gmath.Rad // contains filtered or unexported fields }
func NewContainer ¶
func NewContainer() *Container
func (*Container) AddChild ¶
func (c *Container) AddChild(o DisposableObject)
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 DisposableObject ¶
type DisposableObject interface { Object Dispose() }
type DottedLine ¶
type DottedLine struct { BeginPos gmath.Pos EndPos gmath.Pos // contains filtered or unexported fields }
DottedLine is a 2-point line graphical primitive drawn using small segments.
func NewDottedLine ¶
func NewDottedLine(begin, end gmath.Pos) *DottedLine
NewDottedLine 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} * DotRadius=1 * DotSpacing=3
func (*DottedLine) BoundsRect ¶
func (l *DottedLine) BoundsRect() gmath.Rect
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 (*DottedLine) Dispose ¶
func (l *DottedLine) Dispose()
Dispose marks this line for deletion. After calling this method, IsDisposed will report true.
func (*DottedLine) Draw ¶
func (l *DottedLine) Draw(dst *ebiten.Image)
func (*DottedLine) DrawWithOptions ¶
func (l *DottedLine) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*DottedLine) GetAlpha ¶
func (l *DottedLine) GetAlpha() float32
GetAlpha is a shorthand for GetColorScale().A expression. It's mostly provided for a symmetry with SetAlpha.
func (*DottedLine) GetColorScale ¶
func (l *DottedLine) GetColorScale() ColorScale
GetColorScale is used to retrieve the current color scale value of the line. Use SetColorScale to change it.
func (*DottedLine) GetDotRadius ¶
func (l *DottedLine) GetDotRadius() float64
func (*DottedLine) GetDotSpacing ¶
func (l *DottedLine) GetDotSpacing() float64
func (*DottedLine) IsDisposed ¶
func (l *DottedLine) IsDisposed() bool
IsDisposed reports whether this line is marked for deletion. IsDisposed returns true only after Disposed was called on this line.
func (*DottedLine) IsVisible ¶
func (l *DottedLine) IsVisible() bool
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 (*DottedLine) SetAlpha ¶
func (l *DottedLine) SetAlpha(a float32)
SetAlpha is a convenient way to change the alpha value of the ColorScale.
func (*DottedLine) SetColorScale ¶
func (l *DottedLine) SetColorScale(cs ColorScale)
SetColorScale assigns a new ColorScale to this line. Use GetColorScale to retrieve the current color scale.
func (*DottedLine) SetDotRadius ¶
func (l *DottedLine) SetDotRadius(r float64)
func (*DottedLine) SetDotSpacing ¶
func (l *DottedLine) SetDotSpacing(spacing float64)
func (*DottedLine) SetVisibility ¶
func (l *DottedLine) SetVisibility(visible bool)
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 DrawOptions ¶
type DrawOptions struct { Offset gmath.Vec Rotation gmath.Rad // Blend is an optional blend mode override. // You usually want to use a predefined blend from Ebitengine and // assign it like DrawOptopns{Blend: &ebiten.BlendCopy}. // We're using a pointer here mostly to decrease the [DrawOptions] // object size as most of the time this field is going to be nil. Blend *ebiten.Blend }
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) SetShadow ¶
func (l *Label) SetShadow(cs ColorScale)
SetShadow enables rendered text shadows.
The shadow support is experimental and is inefficient. Right now only a 1 pixel-tall, straight vertical shadow is supported.
Experimental: the API will change in the future.
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 Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
Layer is a simple layer that renders objects in the order they were added.
The objects inside this layer are displayed with respect to the camera transformation.
It expects graphics to implement Object interface. If something implements only a simple gscene Graphics interface, use StaticLayer.
func (*Layer) DrawWithOptions ¶
func (l *Layer) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
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 Object ¶
type Object interface { DrawWithOptions(dst *ebiten.Image, o DrawOptions) // contains filtered or unexported methods }
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 SceneDrawer ¶
type SceneDrawer struct {
// contains filtered or unexported fields
}
func NewSceneDrawer ¶
func NewSceneDrawer(layers []SceneLayerDrawer, minScale float64) *SceneDrawer
NewSceneDrawer creates a configured [gscene.Drawer] for the scene.
It will have a default camera that always has its offset at (0, 0) and its rendered at a full display. This default camera is used if no other cameras are available. Use SceneDrawer.AddCamera to install custom cameras.
A minScale specifies the minimal zoom-out of the camera, e.g. a 0.5 for a double zoom out. This information is needed to prepare the appropriate buffer that could fit all resolutions. When zooming in instead, it doesn't matter as it decreases the visible area. Any values >=1 are essintially ignored. Keep in mind, providing a value like 0.1 means creating an x10 size off-screen image for the temporary buffer.
See SceneDrawer doc comments for more info.
It's advised to only call this function after Ebitengine game has already started.
func (*SceneDrawer) AddCamera ¶
func (d *SceneDrawer) AddCamera(camera *Camera)
func (*SceneDrawer) AddGraphics ¶
func (d *SceneDrawer) AddGraphics(o gsceneGraphics, layer int)
func (*SceneDrawer) Draw ¶
func (d *SceneDrawer) Draw(dst *ebiten.Image)
func (*SceneDrawer) RemoveCamera ¶
func (d *SceneDrawer) RemoveCamera(camera *Camera)
func (*SceneDrawer) Update ¶
func (d *SceneDrawer) Update(delta float64)
type SceneLayerDrawer ¶
type SceneLayerDrawer interface { Update(delta float64) DrawWithOptions(dst *ebiten.Image, opts DrawOptions) AddChild(o gsceneGraphics) }
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.
func (*Shader) SetVec4Value ¶
SetVec4Value assigns vec4 Kage uniform variable. v must be a 4-element slice, otherwise this method will panic.
type ShaderObject ¶
ShaderObject implements shader-based rendering.
Instead of using a dummy sprite/image to draw something with a shader, a ShaderObject should be used instead.
The ShaderObject creates a quad shape out of vertices based on the provided position and sizes (w, h). The associated shader is then executed over that quad and the result of that rendering is drawn right into the Draw dst image.
ShaderObject implements gscene Graphics interface.
func NewShaderObject ¶
func NewShaderObject() *ShaderObject
func (*ShaderObject) Dispose ¶
func (o *ShaderObject) Dispose()
func (*ShaderObject) Draw ¶
func (o *ShaderObject) Draw(dst *ebiten.Image)
func (*ShaderObject) DrawWithOptions ¶
func (o *ShaderObject) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
func (*ShaderObject) GetHeight ¶
func (o *ShaderObject) GetHeight() int
func (*ShaderObject) GetWidth ¶
func (o *ShaderObject) GetWidth() int
func (*ShaderObject) IsDisposed ¶
func (o *ShaderObject) IsDisposed() bool
func (*ShaderObject) IsVisible ¶
func (o *ShaderObject) IsVisible() bool
func (*ShaderObject) SetHeight ¶
func (o *ShaderObject) SetHeight(h int)
func (*ShaderObject) SetVisibility ¶
func (o *ShaderObject) SetVisibility(visible bool)
func (*ShaderObject) SetWidth ¶
func (o *ShaderObject) SetWidth(w int)
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 PivotOffset gmath.Vec // 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 ¶
func NewSprite() *Sprite
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.
type StaticLayer ¶
type StaticLayer struct {
// contains filtered or unexported fields
}
StaticLayer is like Layer, but objects are rendered in a camera-independent way. It renders the objects in the order they were added to the layer.
The objects inside this layer ignore the camera transformation, this is why having just Draw() method on objects is enough.
This layer is well-suited for HUDs and overlays.
func NewStaticLayer ¶
func NewStaticLayer() *StaticLayer
func (*StaticLayer) AddChild ¶
func (l *StaticLayer) AddChild(g gsceneGraphics)
func (*StaticLayer) DrawWithOptions ¶
func (l *StaticLayer) DrawWithOptions(dst *ebiten.Image, _ DrawOptions)
func (*StaticLayer) Update ¶
func (l *StaticLayer) Update(_ float64)
type TextureLine ¶
type TextureLine struct { BeginPos gmath.Pos EndPos gmath.Pos // Shader is an shader that will be used during rendering of the line. // Use NewShader to initialize this field. // // If nil, no shaders will be used. Shader *Shader // contains filtered or unexported fields }
func NewTextureLine ¶
func NewTextureLine(begin, end gmath.Pos) *TextureLine
func (*TextureLine) BoundsRect ¶
func (l *TextureLine) BoundsRect() gmath.Rect
func (*TextureLine) Dispose ¶
func (l *TextureLine) Dispose()
func (*TextureLine) Draw ¶
func (l *TextureLine) Draw(dst *ebiten.Image)
Draw renders the texture 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 (*TextureLine) DrawWithOptions ¶
func (l *TextureLine) DrawWithOptions(dst *ebiten.Image, opts DrawOptions)
DrawWithOptions renders the texture 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 (*TextureLine) GetAlpha ¶
func (l *TextureLine) GetAlpha() float32
GetAlpha is a shorthand for GetColorScale().A expression. It's mostly provided for a symmetry with SetAlpha.
func (*TextureLine) GetColorScale ¶
func (l *TextureLine) GetColorScale() ColorScale
GetColorScale is used to retrieve the current color scale value of texture line. Use SetColorScale to change it.
func (*TextureLine) GetTexture ¶
func (l *TextureLine) GetTexture() *ebiten.Image
func (*TextureLine) IsDisposed ¶
func (l *TextureLine) IsDisposed() bool
func (*TextureLine) IsVisible ¶
func (l *TextureLine) IsVisible() bool
IsVisible reports whether this texture line is visible. Use SetVisibility to change this flag value.
When texture line is invisible (visible=false), it will not be rendered at all. This is an efficient way to temporarily hide a texture line.
func (*TextureLine) SetAlpha ¶
func (l *TextureLine) SetAlpha(a float32)
SetAlpha is a convenient way to change the alpha value of the ColorScale.
func (*TextureLine) SetColorScale ¶
func (l *TextureLine) SetColorScale(cs ColorScale)
SetColorScale assigns a new ColorScale to this texture line. Use GetColorScale to retrieve the current color scale.
func (*TextureLine) SetTexture ¶
func (l *TextureLine) SetTexture(texture *ebiten.Image)
SetTexture assigns the repeatable line texture.
This texture should loop well if the line's length can be higher than the texture's width.
func (*TextureLine) SetVisibility ¶
func (l *TextureLine) SetVisibility(visible bool)
SetVisibility changes the Visible flag value. It can be used to show or hide the texture line. Use IsVisible to get the current flag value.