dcearth/map.lua

88 lines
1.9 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 Nodes = require 'nodes'
2023-04-28 17:35:52 +00:00
local Bitmap = require 'bmp'
local Camera = require 'camera'
2023-04-28 17:35:52 +00:00
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" )
2023-04-28 17:35:52 +00:00
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 )
2023-04-28 17:35:52 +00:00
do --points
2023-07-28 05:42:16 +00:00
2023-04-28 17:35:52 +00:00
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()
2023-04-28 17:35:52 +00:00
lg.setColor( 1, 0, 1, 0.5 )
map.cities.drawSelected( 22.0 / Camera.zoom )
2023-04-28 17:35:52 +00:00
end
do --line stuff
lg.setColor(1, 1, 1, 0.2 )
lg.setLineJoin( "miter" )
lg.setLineWidth( 0.2 / Camera.zoom )
2023-04-28 17:35:52 +00:00
map.international:draw()
lg.setColor(1, 1, 1, 0.5 )
2023-04-28 17:35:52 +00:00
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 )
2023-04-28 17:35:52 +00:00
end
end
end
function map.save()
end
2023-07-28 05:42:16 +00:00
function map.hover(x, y)
2023-04-28 17:35:52 +00:00
end
return map