dcearth/map.lua

88 lines
1.9 KiB
Lua

local lg = love.graphics
local Cities = require 'cities'
local Lines = require 'lines'
local Nodes = require 'nodes'
local Bitmap = require 'bmp'
local Camera = require 'camera'
local map = {
coastlines = false,
coastlinesLow = false,
international = false,
territory = {
af = false,
eu = false,
na = false,
ru = false,
sa = false,
as = false
},
travelnodes = false,
sailable = false,
aimarkers = false,
cities = false
}
function map.load()
map.cities = Cities.load( "data/earth/cities.dat" )
map.coastlines = Lines.load( "data/earth/coastlines.dat" )
map.coastlinesLow = Lines.load( "data/earth/coastlines-low.dat" )
map.international = Lines.load( "data/earth/international.dat" )
map.travelnodes = Nodes.load( "data/earth/travel_nodes.bmp" )
end
function map.draw()
lg.clear( 0, 0, 0, 1 )
do --all this stuff is drawn in world coordinates, ( -180, 180 ) x ( -100, 100 )
lg.replaceTransform( Camera.tf )
do --points
lg.setColor( 1, 0, 0, 0.5 )
lg.setPointSize( 0.5 * Camera.zoom )
map.cities.draw()
lg.setColor( 1, 1, 1.0, 0.5 )
lg.setPointSize( 1.0 * Camera.zoom )
map.cities.drawCapitals()
lg.setColor( 1, 0, 1, 0.5 )
map.cities.drawSelected( 22.0 / Camera.zoom )
end
do --line stuff
lg.setColor(1, 1, 1, 0.2 )
lg.setLineJoin( "miter" )
lg.setLineWidth( 0.2 / Camera.zoom )
map.international:draw()
lg.setColor(1, 1, 1, 0.5 )
map.coastlines:draw()
map.coastlinesLow:draw()
--International Date Line
lg.line( -180, -100, -180, 100 )
lg.line( 180, -100, 180, 100 )
lg.line( -180, 90, 180, 90 )
lg.line( -180, -90, 180, -90 )
lg.line( -180, 100, 180, 100 )
lg.line( -180, -100, 180, -100 )
end
end
end
function map.save()
end
function map.hover(x, y)
end
return map