From 7e3c59eb7d0c7affca6d3bdc2702faba93fe9705 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 15 Jan 2017 14:07:20 +0100 Subject: Map icons list generated rather than static --- assets/maps.png | Bin 0 -> 9305 bytes assets/placeholder-map-icon.png | Bin 8833 -> 0 bytes config/menuhost.lua | 2 +- mapicons.lua | 21 ++++++++++++--------- 4 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 assets/maps.png delete mode 100644 assets/placeholder-map-icon.png diff --git a/assets/maps.png b/assets/maps.png new file mode 100644 index 0000000..a6b442c Binary files /dev/null and b/assets/maps.png differ diff --git a/assets/placeholder-map-icon.png b/assets/placeholder-map-icon.png deleted file mode 100644 index 85b6727..0000000 Binary files a/assets/placeholder-map-icon.png and /dev/null differ diff --git a/config/menuhost.lua b/config/menuhost.lua index 710839d..64ce0e7 100644 --- a/config/menuhost.lua +++ b/config/menuhost.lua @@ -16,7 +16,7 @@ return { :set("global", true) :set("first", true) :set("list", require "maplist") - :set("icons_i", love.graphics.newImage("assets/placeholder-map-icon.png")) + :set("icons_i", love.graphics.newImage("assets/maps.png")) :set("icons_q", require "mapicons") :set("shape", "panorama") :init() diff --git a/mapicons.lua b/mapicons.lua index 3251e2a..6827840 100644 --- a/mapicons.lua +++ b/mapicons.lua @@ -1,9 +1,12 @@ -local w, h = 80, 252 -return { - default = love.graphics.newQuad(2, 3,76,37,w,h), - rill = love.graphics.newQuad(2, 45,76,37,w,h), - ribbit = love.graphics.newQuad(2, 87,76,37,w,h), - starstorm = love.graphics.newQuad(2,129,76,37,w,h), - aiguillon = love.graphics.newQuad(2,171,76,37,w,h), - sorona = love.graphics.newQuad(2,213,76,37,w,h), -} +-- Maps icons list generation file +-- REWORK NEEDED, it is so similar to `nautsicons.lua` they could be merged together into one function that returns icon quad sequences. +local maps = require "maplist" +local w, h = 456, 37 +local icons = {} + +local i = 0 +for _,map in pairs(maps) do + icons[map] = love.graphics.newQuad(i*76, 0, 76, 37, w, h) + i = i + 1 +end +return icons -- cgit v1.1