dcearth/map.lua

77 lines
1.5 KiB
Lua
Raw Normal View History

2023-04-28 17:35:52 +00:00
local lg = love.graphics
local Cities = require 'cities'
local Lines = require 'lines'
local Bitmap = require 'bmp'
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" )
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.push( "transform" )
lg.scale( lg.getCanvas():getDimensions() )
lg.scale( 1 / 360, - 1 / 200 )
lg.translate( 180, -100 )
do --points
lg.setColor( 1, 0, 0, 0.5 )
lg.setPointSize( 2 )
map.cities:draw()
lg.setColor( 1, 0, 0, 1.0 )
lg.setPointSize( 4 )
map.cities:drawCapitals()
end
do --line stuff
lg.setColor(1, 1, 1, 0.2 )
lg.setLineWidth( 0.2 )
map.international:draw()
lg.setColor(1, 1, 1, 1 )
lg.setLineWidth( 0.3 )
map.coastlines:draw()
map.coastlinesLow:draw()
end
lg.pop( )
end
end
function map.save()
end
function map.setVisible()
end
return map