MCPcopy
hub / github.com/EngoEngine/engo / Bounds

Method Bounds

common/level.go:177–195  ·  view source on GitHub ↗

Bounds returns the level boundaries as an engo.AABB object

()

Source from the content-addressed store, hash-verified

175
176// Bounds returns the level boundaries as an engo.AABB object
177func (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
198func (l *Level) mapPoint(screenPt engo.Point) engo.Point {

Callers 9

TestTMXLevelFunction · 0.80
TestTMXLevelIsometricFunction · 0.80
RenderNRGBAMethod · 0.80
generateFontAtlasMethod · 0.80
LoadMethod · 0.80
ImageToNRGBAFunction · 0.80
SetupMethod · 0.80
SetupMethod · 0.80
SetupMethod · 0.80

Calls 1

screenPointMethod · 0.95

Tested by 2

TestTMXLevelFunction · 0.64
TestTMXLevelIsometricFunction · 0.64