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 Territory = require 'territory' local map = { coastlines = false, coastlinesLow = false, international = false, territory = { africa = false, europe = false, northamerica = false, russia = false, southamerica = false, southasia = 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" ) for k, v in pairs(map.territory) do map.territory[k] = Territory.load( "data/earth/"..k..".bmp", k ) end map.sailable = Territory.load( "data/earth/sailable.bmp", "sailable" ) end function map.draw() lg.clear( 0, 0, 0, 1 ) do --travel nodes map.travelnodes:draw() end do --territory lg.replaceTransform( Camera.tfTerritory ) lg.setBlendMode( "add" ) for k, v in pairs(map.territory) do if v.visible then v:draw() end end if map.sailable.visible then map.sailable:draw() end lg.setBlendMode( "alpha" ) end 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