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

Method mapPoint

common/level.go:198–210  ·  view source on GitHub ↗

mapPoint returns the map point of the passed in screen point

(screenPt engo.Point)

Source from the content-addressed store, hash-verified

196
197// mapPoint returns the map point of the passed in screen point
198func (l *Level) mapPoint(screenPt engo.Point) engo.Point {
199 switch l.Orientation {
200 case orth:
201 screenPt.Multiply(engo.Point{X: 1 / float32(l.TileWidth), Y: 1 / float32(l.TileHeight)})
202 return screenPt
203 case iso:
204 return engo.Point{
205 X: (screenPt.X / float32(l.TileWidth)) + (screenPt.Y / float32(l.TileHeight)),
206 Y: (screenPt.Y / float32(l.TileHeight)) - (screenPt.X / float32(l.TileWidth)),
207 }
208 }
209 return engo.Point{X: 0, Y: 0}
210}
211
212// screenPoint returns the screen point of the passed in map point
213func (l *Level) screenPoint(mapPt engo.Point) engo.Point {

Callers 1

GetTileMethod · 0.95

Calls 1

MultiplyMethod · 0.45

Tested by

no test coverage detected