mapPoint returns the map point of the passed in screen point
(screenPt engo.Point)
| 196 | |
| 197 | // mapPoint returns the map point of the passed in screen point |
| 198 | func (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 |
| 213 | func (l *Level) screenPoint(mapPt engo.Point) engo.Point { |