graph

package
v0.0.0-...-32a2d26 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cycle_OneTime int = iota
	Cycle_Loop
	Cycle_PingPong
)
View Source
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
)
View Source
const Deg2Rad = math.Pi / 180

Variables

This section is empty.

Functions

func Arrow

func Arrow(Q *DrawQueue, cam *Camera, from, to v2.V2, clr color.Color, ang, len float64, layer int)

func BotLeft

func BotLeft() v2.V2

func BotRight

func BotRight() v2.V2

func CalcGlobalScale

func CalcGlobalScale(H int) float64

func Center

func Center() v2.V2

func ClearCache

func ClearCache()

func GS

func GS() float64

global scale factor

func GetFace

func GetFace(fileName string, size float64, loader func(filename string) ([]byte, error)) (font.Face, error)

func Line

func Line(Q *DrawQueue, cam *Camera, from, to v2.V2, clr color.Color, layer int)

func LineHUD

func LineHUD(Q *DrawQueue, cam *Camera, from v2.V2, v V2, clr color.Color, layer int)

func LineScr

func LineScr(Q *DrawQueue, from, to v2.V2, clr color.Color, layer int)

func MidBottom

func MidBottom() v2.V2

func MidLeft

func MidLeft() v2.V2

func NormAng

func NormAng(angle float64) float64

put angle in degs in [0;360) range

func NormAngRange

func NormAngRange(start, end float64) (float64, float64)

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 ScrP

func ScrP(x, y float64) v2.V2

func SetScreenSize

func SetScreenSize(W, H int)

func StoreTexCache

func StoreTexCache(cacheName string, tex Tex)

func TopLeft

func TopLeft() v2.V2

func TopMiddle

func TopMiddle() v2.V2

func TopRight

func TopRight() v2.V2

Types

type ArrayElem

type ArrayElem struct {
	Pos      v2.V2
	Size     float64
	AngDeg   float64
	SpriteN  int
	LifeTime float64
}

type CamParams

type CamParams struct {
	Cam       *Camera
	DenyScale bool
	DenyAngle bool
}
var NoCam CamParams

func NewCamParams

func NewCamParams(cam *Camera, denyScale, denyAngle bool) CamParams

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 NewCamera

func NewCamera() *Camera

func (*Camera) Apply

func (c *Camera) Apply(p v2.V2) v2.V2

func (*Camera) CircleInSpace

func (c *Camera) CircleInSpace(center v2.V2, radius float64) bool

func (*Camera) Deny

func (c *Camera) Deny() CamParams

func (*Camera) FixS

func (c *Camera) FixS() CamParams

func (*Camera) Geom

func (c *Camera) Geom() ebiten.GeoM

func (*Camera) Params

func (c *Camera) Params(denyScale, denyAngle bool) CamParams

func (*Camera) Phys

func (c *Camera) Phys() CamParams

func (*Camera) PointInSpace

func (c *Camera) PointInSpace(p v2.V2) bool

if object is in camera space always return true may return true if object is out of space

func (*Camera) Recalc

func (c *Camera) Recalc()

func (*Camera) RectInSpace

func (c *Camera) RectInSpace(center v2.V2, w, h float64) bool

do not count angle, just use outer circle

func (*Camera) SetClip

func (c *Camera) SetClip(w, h int)

func (*Camera) UnApply

func (c *Camera) UnApply(p v2.V2) v2.V2

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 CircleLineOpts struct {
	Params CamParams
	Clr    color.Color
	Layer  int
	PCount int
}

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 DrawF

type DrawF = func(image *ebiten.Image)

type DrawQueue

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

func NewDrawQueue

func NewDrawQueue() *DrawQueue

func (*DrawQueue) Add

func (dq *DrawQueue) Add(drawer drawer, layer int)

For simple objects(like Sprite amd other graph primitives) that do not know it's layer

func (*DrawQueue) Append

func (dq *DrawQueue) Append(drawQueuer drawQueuer)

For game objects that create a set of requests with layers and groups

func (*DrawQueue) Clear

func (dq *DrawQueue) Clear()

func (*DrawQueue) Len

func (dq *DrawQueue) Len() int

func (*DrawQueue) Run

func (dq *DrawQueue) Run(dest *ebiten.Image)

type DrawReq

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

func NewReq

func NewReq(layer int, group string, f DrawF) DrawReq

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 Frame9HUD

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

func NewFrame9

func NewFrame9(sprites [9]*Sprite, w, h float64, layer int) (res *Frame9HUD)

func (*Frame9HUD) MinSize

func (f9 *Frame9HUD) MinSize() (w, h float64)

func (*Frame9HUD) Req

func (f9 *Frame9HUD) Req(Q *DrawQueue)

func (*Frame9HUD) SetScale

func (f9 *Frame9HUD) SetScale(scale float64)

func (*Frame9HUD) SetSize

func (f9 *Frame9HUD) SetSize(w, h float64)

type Sector

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

func NewSector

func NewSector(params CamParams) *Sector

func (*Sector) Draw

func (s *Sector) Draw(dest *ebiten.Image)

func (*Sector) DrawF

func (s *Sector) DrawF() (DrawF, string)

func (*Sector) SetAlpha

func (s *Sector) SetAlpha(alpha float64)

func (*Sector) SetAngles

func (s *Sector) SetAngles(start, end float64)

func (*Sector) SetCenter

func (s *Sector) SetCenter(center v2.V2)

func (*Sector) SetCenterRadius

func (s *Sector) SetCenterRadius(center v2.V2, radius float64)

func (*Sector) SetColor

func (s *Sector) SetColor(color color.Color)

func (*Sector) SetRadius

func (s *Sector) SetRadius(radius 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 NewSprite

func NewSprite(tex Tex, params CamParams) *Sprite

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 NewSpriteHUD

func NewSpriteHUD(tex Tex) *Sprite

without cam

func (*Sprite) AddAng

func (s *Sprite) AddAng(dAng float64)

func (*Sprite) Cols

func (s *Sprite) Cols() int

func (*Sprite) Draw

func (s *Sprite) Draw(dest *ebiten.Image)

func (*Sprite) DrawF

func (s *Sprite) DrawF() (DrawF, string)

MUST support multiple draw with different parameters

func (*Sprite) GetRect

func (s *Sprite) GetRect() image.Rectangle

for noCam use in fact

func (*Sprite) ImageOp

func (s *Sprite) ImageOp() (*ebiten.Image, *ebiten.DrawImageOptions)

Copy options, so cam apply do not change

func (*Sprite) IsOver

func (s *Sprite) IsOver(pos v2.V2, checkTransparent bool) bool

func (*Sprite) NextSprite

func (s *Sprite) NextSprite()

func (*Sprite) Rows

func (s *Sprite) Rows() int

func (*Sprite) SetAlpha

func (s *Sprite) SetAlpha(a float64)

func (*Sprite) SetAng

func (s *Sprite) SetAng(angleDeg float64)

func (*Sprite) SetColor

func (s *Sprite) SetColor(color color.Color)

func (*Sprite) SetPivot

func (s *Sprite) SetPivot(pivotPartial v2.V2)

pivotPartial is [0..1,0..1] vector of pivot point in parts of image size

func (*Sprite) SetPos

func (s *Sprite) SetPos(pos v2.V2)

func (*Sprite) SetPosAng

func (s *Sprite) SetPosAng(pos v2.V2, angle float64)

func (*Sprite) SetScale

func (s *Sprite) SetScale(x, y float64)

func (*Sprite) SetSize

func (s *Sprite) SetSize(x, y float64)

func (*Sprite) SetSizeProportion

func (s *Sprite) SetSizeProportion(size float64)

func (*Sprite) SetSpriteN

func (s *Sprite) SetSpriteN(n int)

func (*Sprite) SetTex

func (s *Sprite) SetTex(t Tex)

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 (s *Sprite) SkipDrawCheck() bool

func (*Sprite) SpriteN

func (s *Sprite) SpriteN() int

func (*Sprite) SpritesCount

func (s *Sprite) SpritesCount() int

func (*Sprite) TexImageDispose

func (s *Sprite) TexImageDispose()

type Tex

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

func CheckTexCache

func CheckTexCache(cacheName string) (Tex, bool)

func CircleTex

func CircleTex() Tex

func GetTex

func GetTex(filename string, smoothFilter bool, sw, sh int, count int,
	loader func(filename string) (io.Reader, error)) (Tex, error)

func RoundTex

func RoundTex(source Tex) (result Tex)

cache it manually

func SlidingTex

func SlidingTex(source Tex) (result Tex)

cache it manually

func TexFromImage

func TexFromImage(image *ebiten.Image, filter ebiten.Filter, sw, sh int, count int, name string) Tex

func (Tex) Size

func (t Tex) Size() (w, h int)

type Text

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

func NewText

func NewText(text string, face font.Face, color color.Color) *Text

func (*Text) Draw

func (t *Text) Draw(dst *ebiten.Image)

func (*Text) DrawF

func (t *Text) DrawF() (DrawF, string)

func (*Text) GetSize

func (t *Text) GetSize() (w, h int)

func (*Text) Image

func (t *Text) Image() *ebiten.Image

func (*Text) SetFilter

func (t *Text) SetFilter(filter ebiten.Filter)

func (*Text) SetPosPivot

func (t *Text) SetPosPivot(pos, pivot v2.V2)

type V2

type V2 = v2.V2

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)

type WavedCircleOpts

type WavedCircleOpts struct {
	Sprite  *Sprite
	Params  CamParams
	Layer   int
	PCount  int
	RandGen string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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