Documentation
¶
Index ¶
- Constants
- func Arrow(Q *DrawQueue, cam *Camera, from, to v2.V2, clr color.Color, ang, len float64, ...)
- func BotLeft() v2.V2
- func BotRight() v2.V2
- func CalcGlobalScale(H int) float64
- func Center() v2.V2
- func ClearCache()
- func GS() float64
- func GetFace(fileName string, size float64, loader func(filename string) ([]byte, error)) (font.Face, error)
- func Line(Q *DrawQueue, cam *Camera, from, to v2.V2, clr color.Color, layer int)
- func LineHUD(Q *DrawQueue, cam *Camera, from v2.V2, v V2, clr color.Color, layer int)
- func LineScr(Q *DrawQueue, from, to v2.V2, clr color.Color, layer int)
- func MidBottom() v2.V2
- func MidLeft() v2.V2
- func NormAng(angle float64) float64
- func NormAngRange(start, end float64) (float64, float64)
- func ScrP(x, y float64) v2.V2
- func SetScreenSize(W, H int)
- func StoreTexCache(cacheName string, tex Tex)
- func TopLeft() v2.V2
- func TopMiddle() v2.V2
- func TopRight() v2.V2
- type ArrayElem
- type CamParams
- type Camera
- func (c *Camera) Apply(p v2.V2) v2.V2
- func (c *Camera) CircleInSpace(center v2.V2, radius float64) bool
- func (c *Camera) Deny() CamParams
- func (c *Camera) FixS() CamParams
- func (c *Camera) Geom() ebiten.GeoM
- func (c *Camera) Params(denyScale, denyAngle bool) CamParams
- func (c *Camera) Phys() CamParams
- func (c *Camera) PointInSpace(p v2.V2) bool
- func (c *Camera) Recalc()
- func (c *Camera) RectInSpace(center v2.V2, w, h float64) bool
- func (c *Camera) SetClip(w, h int)
- func (c *Camera) UnApply(p v2.V2) v2.V2
- type CircleLine
- type CircleLineOpts
- type CycledSprite
- type DrawF
- type DrawQueue
- type DrawReq
- type FadingArray
- type Frame9HUD
- type Sector
- func (s *Sector) Draw(dest *ebiten.Image)
- func (s *Sector) DrawF() (DrawF, string)
- func (s *Sector) SetAlpha(alpha float64)
- func (s *Sector) SetAngles(start, end float64)
- func (s *Sector) SetCenter(center v2.V2)
- func (s *Sector) SetCenterRadius(center v2.V2, radius float64)
- func (s *Sector) SetColor(color color.Color)
- func (s *Sector) SetRadius(radius float64)
- type SlidingSprite
- type Sprite
- func (s *Sprite) AddAng(dAng float64)
- func (s *Sprite) Cols() int
- func (s *Sprite) Draw(dest *ebiten.Image)
- func (s *Sprite) DrawF() (DrawF, string)
- func (s *Sprite) GetRect() image.Rectangle
- func (s *Sprite) ImageOp() (*ebiten.Image, *ebiten.DrawImageOptions)
- func (s *Sprite) IsOver(pos v2.V2, checkTransparent bool) bool
- func (s *Sprite) NextSprite()
- func (s *Sprite) Rows() int
- func (s *Sprite) SetAlpha(a float64)
- func (s *Sprite) SetAng(angleDeg float64)
- func (s *Sprite) SetColor(color color.Color)
- func (s *Sprite) SetPivot(pivotPartial v2.V2)
- func (s *Sprite) SetPos(pos v2.V2)
- func (s *Sprite) SetPosAng(pos v2.V2, angle float64)
- func (s *Sprite) SetScale(x, y float64)
- func (s *Sprite) SetSize(x, y float64)
- func (s *Sprite) SetSizeProportion(size float64)
- func (s *Sprite) SetSpriteN(n int)
- func (s *Sprite) SetTex(t Tex)
- func (s *Sprite) SkipDrawCheck() bool
- func (s *Sprite) SpriteN() int
- func (s *Sprite) SpritesCount() int
- func (s *Sprite) TexImageDispose()
- type Tex
- func CheckTexCache(cacheName string) (Tex, bool)
- func CircleTex() Tex
- func GetTex(filename string, smoothFilter bool, sw, sh int, count int, ...) (Tex, error)
- func RoundTex(source Tex) (result Tex)
- func SlidingTex(source Tex) (result Tex)
- func TexFromImage(image *ebiten.Image, filter ebiten.Filter, sw, sh int, count int, name string) Tex
- type Text
- type V2
- type WavedCircle
- type WavedCircleOpts
Constants ¶
const ( Cycle_OneTime int = iota Cycle_Loop Cycle_PingPong )
const ( //Static back, usually one instance Z_STAT_BACKGROUND = iota * 100 //Dynamic back, i.e. coordinate axises Z_BACKGROUND //under game object, i.e. selection glow Z_UNDER_OBJECT //main objects Z_GAME_OBJECT //Above objects. Gizmos and labels Z_ABOVE_OBJECT //non cam parts of UI Z_HUD //static HUD, for nice edges Z_STAT_HUD )
const Deg2Rad = math.Pi / 180
Variables ¶
This section is empty.
Functions ¶
func CalcGlobalScale ¶
func ClearCache ¶
func ClearCache()
func NormAngRange ¶
normalize start angle in [0;360) and end in [start; start+360) so always end > start. End value itself may be more than 360
func SetScreenSize ¶
func SetScreenSize(W, H int)
func StoreTexCache ¶
Types ¶
type Camera ¶
type Camera struct { //center in world Pos v2.V2 //center on screen Center v2.V2 //angle in deg, PLUS camera counterclock (image clockwise) AngleDeg float64 //scale Scale float64 DenyGlobalScale bool //in screen pixels, zero means no clipping ClipW, ClipH float64 // contains filtered or unexported fields }
exec Recalc() after changes
func (*Camera) PointInSpace ¶
if object is in camera space always return true may return true if object is out of space
func (*Camera) RectInSpace ¶
do not count angle, just use outer circle
type CircleLine ¶
type CircleLine struct {
// contains filtered or unexported fields
}
func NewCircleLine ¶
func NewCircleLine(center v2.V2, radius float64, opts CircleLineOpts) *CircleLine
func (*CircleLine) Req ¶
func (cl *CircleLine) Req(Q *DrawQueue)
func (*CircleLine) SetColor ¶
func (cl *CircleLine) SetColor(clr color.Color)
func (*CircleLine) SetPos ¶
func (cl *CircleLine) SetPos(pos v2.V2)
func (*CircleLine) SetRadius ¶
func (cl *CircleLine) SetRadius(r float64)
type CircleLineOpts ¶
type CycledSprite ¶
type CycledSprite struct { Sprite // contains filtered or unexported fields }
func NewCycledSprite ¶
func NewCycledSprite(sprite *Sprite, cycleType int, fps float64) *CycledSprite
func NewCycledSpriteRange ¶
func NewCycledSpriteRange(sprite *Sprite, cycleType int, fps float64, min, max int) *CycledSprite
func (*CycledSprite) Reset ¶
func (cs *CycledSprite) Reset()
func (*CycledSprite) SetPause ¶
func (cs *CycledSprite) SetPause(paused bool)
func (*CycledSprite) Update ¶
func (cs *CycledSprite) Update(dt float64)
type DrawQueue ¶
type DrawQueue struct {
// contains filtered or unexported fields
}
func NewDrawQueue ¶
func NewDrawQueue() *DrawQueue
func (*DrawQueue) Add ¶
For simple objects(like Sprite amd other graph primitives) that do not know it's layer
type FadingArray ¶
type FadingArray struct {
// contains filtered or unexported fields
}
func NewFadingArray ¶
func NewFadingArray(tex Tex, cap int, params CamParams) (res *FadingArray)
func (*FadingArray) Add ¶
func (sa *FadingArray) Add(elem ArrayElem)
func (*FadingArray) Clear ¶
func (sa *FadingArray) Clear()
func (*FadingArray) Draw ¶
func (sa *FadingArray) Draw(img *ebiten.Image)
func (*FadingArray) DrawF ¶
func (sa *FadingArray) DrawF() (DrawF, string)
func (*FadingArray) Update ¶
func (sa *FadingArray) Update(dt float64)
type SlidingSprite ¶
type SlidingSprite struct {
// contains filtered or unexported fields
}
func NewSlidingSprite ¶
func NewSlidingSprite(sprite *Sprite) *SlidingSprite
func (*SlidingSprite) AddSlide ¶
func (s *SlidingSprite) AddSlide(deltaSlide float64)
func (*SlidingSprite) Draw ¶
func (s *SlidingSprite) Draw(dest *ebiten.Image)
func (*SlidingSprite) DrawF ¶
func (s *SlidingSprite) DrawF() (DrawF, string)
MUST support multiple draw with different parameters
func (*SlidingSprite) ImageOp ¶
func (s *SlidingSprite) ImageOp() (*ebiten.Image, *ebiten.DrawImageOptions)
Copy options, so cam apply do not change
func (*SlidingSprite) SetSlide ¶
func (s *SlidingSprite) SetSlide(slide float64)
cut integer part from slide, so you can pass anything
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
func NewSpriteFromFile ¶
func NewSpriteFromFile(filename string, smoothFilter bool, sw, sh int, count int, params CamParams) (*Sprite, error)
doesn't do cache. for tests and models, better use AtlasTex
func (*Sprite) ImageOp ¶
func (s *Sprite) ImageOp() (*ebiten.Image, *ebiten.DrawImageOptions)
Copy options, so cam apply do not change
func (*Sprite) NextSprite ¶
func (s *Sprite) NextSprite()
func (*Sprite) SetSizeProportion ¶
func (*Sprite) SetSpriteN ¶
func (*Sprite) SetTex ¶
do not check for new tex size or sprite count so it is highly recommended to use the same size textures
func (*Sprite) SkipDrawCheck ¶
func (*Sprite) SpritesCount ¶
func (*Sprite) TexImageDispose ¶
func (s *Sprite) TexImageDispose()
type Tex ¶
type Tex struct {
// contains filtered or unexported fields
}
func CheckTexCache ¶
func TexFromImage ¶
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func (*Text) SetPosPivot ¶
type WavedCircle ¶
type WavedCircle struct {
// contains filtered or unexported fields
}
func NewWavedCircle ¶
func NewWavedCircle(center v2.V2, radMin, radMax float64, opts WavedCircleOpts) *WavedCircle
func (*WavedCircle) Req ¶
func (wc *WavedCircle) Req(Q *DrawQueue)
func (*WavedCircle) SetPos ¶
func (wc *WavedCircle) SetPos(pos v2.V2)
func (*WavedCircle) SetRadius ¶
func (wc *WavedCircle) SetRadius(min, max float64)
func (*WavedCircle) Update ¶
func (wc *WavedCircle) Update(dt float64)