NewSpritesheetWithBorderFromFile creates a new spritesheet from a file This sheet has sprites of a uniform width and height, but also have borders around each sprite to prevent bleeding over
(textureName string, cellWidth, cellHeight, borderWidth, borderHeight int)
| 102 | // This sheet has sprites of a uniform width and height, but also have borders around |
| 103 | // each sprite to prevent bleeding over |
| 104 | func NewSpritesheetWithBorderFromFile(textureName string, cellWidth, cellHeight, borderWidth, borderHeight int) *Spritesheet { |
| 105 | res, err := engo.Files.Resource(textureName) |
| 106 | if err != nil { |
| 107 | log.Println("[WARNING] [NewSpritesheetWithBorderFromFile]: Received error:", err) |
| 108 | return nil |
| 109 | } |
| 110 | |
| 111 | img, ok := res.(TextureResource) |
| 112 | if !ok { |
| 113 | log.Println("[WARNING] [NewSpritesheetWithBorderFromFile]: Resource not of type `TextureResource`:", textureName) |
| 114 | return nil |
| 115 | } |
| 116 | |
| 117 | return NewSpritesheetWithBorderFromTexture(&img, cellWidth, cellHeight, borderWidth, borderHeight) |
| 118 | } |
| 119 | |
| 120 | // Cell gets the region at the index i, updates and pulls from cache if need be |
| 121 | func (s *Spritesheet) Cell(index int) Texture { |
no test coverage detected