Bounds returns the level boundaries as an engo.AABB object
()
| 175 | |
| 176 | // Bounds returns the level boundaries as an engo.AABB object |
| 177 | func (l *Level) Bounds() engo.AABB { |
| 178 | switch l.Orientation { |
| 179 | case orth: |
| 180 | return engo.AABB{ |
| 181 | Min: l.screenPoint(engo.Point{X: 0, Y: 0}), |
| 182 | Max: l.screenPoint(engo.Point{X: float32(l.width), Y: float32(l.height)}), |
| 183 | } |
| 184 | case iso: |
| 185 | xMin := l.screenPoint(engo.Point{X: 0, Y: float32(l.height)}).X + float32(l.TileWidth)/2 |
| 186 | xMax := l.screenPoint(engo.Point{X: float32(l.width), Y: 0}).X + float32(l.TileWidth)/2 |
| 187 | yMin := l.screenPoint(engo.Point{X: 0, Y: 0}).Y |
| 188 | yMax := l.screenPoint(engo.Point{X: float32(l.width), Y: float32(l.height)}).Y + float32(l.TileHeight)/2 |
| 189 | return engo.AABB{ |
| 190 | Min: engo.Point{X: xMin, Y: yMin}, |
| 191 | Max: engo.Point{X: xMax, Y: yMax}, |
| 192 | } |
| 193 | } |
| 194 | return engo.AABB{} |
| 195 | } |
| 196 | |
| 197 | // mapPoint returns the map point of the passed in screen point |
| 198 | func (l *Level) mapPoint(screenPt engo.Point) engo.Point { |