Documentation ¶
Index ¶
- func AnchorTxt(txt *text.Text, pos pixel.Vec, anchorX AnchorX, anchorY AnchorY, desc string)
- func AtlasASCII() *text.Atlas
- func Direction(from, to pixel.Vec) (dirVecNormalized pixel.Vec)
- func ItfsToStrs(itfs []interface{}) (strs []string)
- func LoadPicture(_bytes []byte) (pixel.Picture, error)
- func LoadPictureFromFile(path string) (pixel.Picture, error)
- func LoadTrueTypeFont(bytes []byte, size float64) (font.Face, error)
- func LoadTrueTypeFontFromFile(path string, size float64) (font.Face, error)
- func NewAtlas(nameAssetTTF string, size float64, runeSet []rune) *text.Atlas
- func NewSprite(nameAsset string) *pixel.Sprite
- func RandomNiceColor() pixel.RGBA
- func VerticesOfRect(r pixel.Rect) []pixel.Vec
- type Aim
- type AnchorX
- type AnchorY
- type Camera
- func (camera Camera) Angle() float64
- func (camera *Camera) Move(distance pixel.Vec)
- func (camera *Camera) MoveTo(posAim pixel.Vec)
- func (camera *Camera) Rotate(degree float64)
- func (camera *Camera) SetScreenBound(screenBound pixel.Rect)
- func (camera Camera) Transform() pixel.Matrix
- func (camera Camera) Unproject(screenPosition pixel.Vec) (gamePosition pixel.Vec)
- func (camera *Camera) Update(dt float64)
- func (camera Camera) XY() pixel.Vec
- func (camera Camera) XYZ() (float64, float64, float64)
- func (camera Camera) Z() float64
- func (camera *Camera) Zoom(byLevel float64)
- type DtWatch
- func (watch *DtWatch) Dt() (deltaTimeInSeconds float64)
- func (watch *DtWatch) DtNano() (deltaTimeInNanosec time.Duration)
- func (watch DtWatch) DtSinceStart() (deltaTimeInSeconds float64)
- func (watch DtWatch) GetTimeStarted() time.Time
- func (watch DtWatch) IsStarted() bool
- func (watch *DtWatch) SetTimeStarted(t time.Time)
- func (watch *DtWatch) Start()
- type Explosions
- type FPSWatch
- type Galaxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtlasASCII ¶
AtlasASCII returns an atlas which allows you to draw only ASCII characters. Atlas is a set of generated textures for glyphs in a specific font.
func Direction ¶
Direction returns a direction as a normalized vector. This vector always has a length of 1.
func ItfsToStrs ¶
func ItfsToStrs(itfs []interface{}) (strs []string)
ItfsToStrs converts []interface{} to []string.
func LoadPicture ¶
LoadPicture decodes an image that has been encoded in a registered format. (png, jpg, etc.) Format registration is typically done by an init function in the codec-specific package. (with underscore import)
func LoadPictureFromFile ¶
LoadPictureFromFile decodes an image that has been encoded in a registered format. (png, jpg, etc.) Format registration is typically done by an init function in the codec-specific package. (with underscore import)
func LoadTrueTypeFont ¶
LoadTrueTypeFont creates and returns a font face.
func LoadTrueTypeFontFromFile ¶
LoadTrueTypeFontFromFile creates and returns a font face.
func NewAtlas ¶
NewAtlas newly loads and prepares a set of images of characters or symbols to be drawn. Arg runeSet would be set to nil if non-ASCII characters are not in use.
func NewSprite ¶
NewSprite converts an asset (resource) into a sprite. Returns nil if there is an error. AssetNames() or AssetDir() might be helpful when utilizing this function.
func RandomNiceColor ¶
RandomNiceColor from Platformer. Is not completely random without rand.Seed().
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera is a tool to get the screen center to be able to follow a certain point on a plane.
func (*Camera) SetScreenBound ¶
SetScreenBound of a camera.
func (Camera) Transform ¶
Transform returns a transformation matrix of a camera. Use Transform().Project() to convert a game position to a screen position. To do the inverse operation, it is recommended to use Camera#Unproject() rather than Transform().Unproject()
func (Camera) Unproject ¶
Unproject converts a screen position to a game position. This method is a replacement of Transform().Unproject() which might return a bit off position.
func (*Camera) Update ¶
Update a camera's current physical state (physics) by calculating coordinates X, Y, Z and its angle after delta time in seconds.
type DtWatch ¶
type DtWatch struct {
// contains filtered or unexported fields
}
DtWatch is a delta time checker.
func (*DtWatch) Dt ¶
Dt since last Dt() or DtNano(). .Start() must be called prior to calling this method.
func (*DtWatch) DtNano ¶
DtNano since last Dt() or DtNano(). It returns a time instance with nanosecond precision. .Start() must be called prior to calling this method.
func (DtWatch) DtSinceStart ¶
DtSinceStart is dt since last Start(). .Start() must be called prior to calling this method.
func (DtWatch) GetTimeStarted ¶
GetTimeStarted gets the time it started. .Start() must be called prior to calling this method.
func (DtWatch) IsStarted ¶
IsStarted () determines whether it has started or not. .Start() is <not> required in order to call this method.
func (*DtWatch) SetTimeStarted ¶
SetTimeStarted sets the time it started. .Start() must be called prior to calling this method.
type Explosions ¶
type Explosions struct {
// contains filtered or unexported fields
}
Explosions is an imdraw and a manager of all particles.
func NewExplosions ¶
func NewExplosions(width, height float64, colors []color.Color, precision int) *Explosions
NewExplosions is a constructor. The 3rd argument colors can be nil. Then it will use its default value of a color set.
func (*Explosions) Draw ¶
func (e *Explosions) Draw(t pixel.Target)
Draw guarantees the thread safety, though it's not a necessary condition. It is quite dangerous to access this struct's member (imdraw) directly from outside these methods.
func (*Explosions) ExplodeAt ¶
func (e *Explosions) ExplodeAt(pos, vel pixel.Vec)
ExplodeAt generates an explosion at given point.
func (*Explosions) IsExploding ¶
func (e *Explosions) IsExploding() bool
IsExploding determines whether this Explosions is about to be updated or not.
func (*Explosions) SetBound ¶
func (e *Explosions) SetBound(width, height float64)
SetBound of particles. All particles bounce when they meet this bound.
func (*Explosions) Update ¶
func (e *Explosions) Update(dt float64)
Update animates an Explosions. An Explosions is drawn on an imdraw.
type FPSWatch ¶
type FPSWatch struct {
// contains filtered or unexported fields
}
FPSWatch measures the real-time frame rates and displays it on a target canvas.
func NewFPSWatch ¶
func NewFPSWatch( additionalCaption string, _pos pixel.Vec, _anchorY AnchorY, _anchorX AnchorX, _colorBg, _colorTxt color.Color, ) (watch *FPSWatch)
NewFPSWatch is a constructor.
func NewFPSWatchSimple ¶
NewFPSWatchSimple is a constructor.
func (FPSWatch) GetFPS ¶
GetFPS returns the most recent FPS recorded. A non-ptr FPSWatch as a read only argument passes lock by value within itself but that seems totally fine.
func (*FPSWatch) Poll ¶
func (watch *FPSWatch) Poll()
Poll () should be called only once and in every single frame. (Obligatory) This is an extended behavior of Update() like funcs.
type Galaxy ¶
type Galaxy struct {
// contains filtered or unexported fields
}
Galaxy is an imd of stars.
func (*Galaxy) Draw ¶
Draw guarantees the thread safety, though it's not a necessary condition. It is quite dangerous to access this struct's member (imdraw) directly from outside these methods.