Documentation
¶
Index ¶
- Constants
- type PanDirection
- type TileKey
- type TileMap
- func (tm *TileMap) CalculateVisibleTileRange() (TileRange, float64, float64)
- func (tm *TileMap) Draw(screen *ebiten.Image, debugMode bool) TileRange
- func (tm *TileMap) Pan(dir PanDirection)
- func (tm *TileMap) PanBy(dx, dy float64)
- func (tm *TileMap) ScreenToWorld(screenX, screenY float64) (tileX, tileY float64)
- func (tm *TileMap) ZoomAtPoint(zoomIn bool, screenX, screenY float64)
- func (tm *TileMap) ZoomIn()
- func (tm *TileMap) ZoomOut()
- type TileRange
Constants ¶
View Source
const ( // TileSize is the size of map tiles in pixels TileSize = 256 // MaxZoomLevel is the maximum zoom level supported MaxZoomLevel = 19 )
View Source
const PanSpeed = 50
PanSpeed in pixels per frame
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PanDirection ¶
type PanDirection int
PanDirection represents a direction to pan the map
const ( PanLeft PanDirection = iota PanRight PanUp PanDown )
type TileMap ¶
type TileMap struct {
// View state
CenterLat float64
CenterLon float64
Zoom int
ScreenWidth int
ScreenHeight int
// contains filtered or unexported fields
}
TileMap manages the slippy map tile system
func (*TileMap) CalculateVisibleTileRange ¶
CalculateVisibleTileRange determines which tiles are needed for the current view
func (*TileMap) Pan ¶
func (tm *TileMap) Pan(dir PanDirection)
Pan moves the map center in the specified direction by a fixed number of pixels
func (*TileMap) PanBy ¶
PanBy moves the map by pixel offsets dx,dy are in screen pixels, positive dx moves map west (view east), positive dy moves map south (view north)
func (*TileMap) ScreenToWorld ¶
ScreenToWorld converts screen coordinates to tile coordinates
func (*TileMap) ZoomAtPoint ¶
ZoomAtPoint zooms the map while keeping the given world point at the same screen location
Click to show internal directories.
Click to hide internal directories.