12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package ax
- import "surdeus.su/core/gg"
- type Animation []*gg.Image
- type RectIndex struct {
- X, Y int
- }
- // The type is used
- // to structurely define
- // animations.
- type AnimationDefine struct{
- Id AnimationID
- Indexes []RectIndex
- }
- // Animation define shortcut.
- func AD(
- id AnimationID,
- indexes ...RectIndex,
- ) AnimationDefine {
- return AnimationDefine{
- Id: id,
- Indexes: indexes,
- }
- }
- func (ad AnimationDefine) DefRow(
- y int, xs ...int,
- ) AnimationDefine {
- for _, x := range xs {
- ad.Indexes = append(
- ad.Indexes,
- RectIndex{x, y},
- )
- }
- return ad
- }
- func (ad AnimationDefine) DefCol(
- x int, ys ...int,
- ) AnimationDefine {
- for _, y := range ys {
- ad.Indexes = append(
- ad.Indexes,
- RectIndex{x, y},
- )
- }
- return ad
- }
|