2022-08-01 16:05:39 +00:00
|
|
|
-- Color Map Graphics Element
|
|
|
|
|
|
|
|
local element = require("graphics.element")
|
|
|
|
|
|
|
|
---@class colormap_args
|
|
|
|
---@field parent graphics_element
|
|
|
|
---@field id? string element id
|
|
|
|
---@field x? integer 1 if omitted
|
2023-07-10 03:42:44 +00:00
|
|
|
---@field y? integer auto incremented if omitted
|
2023-05-25 21:40:16 +00:00
|
|
|
---@field hidden? boolean true to hide on initial draw
|
2022-08-01 16:05:39 +00:00
|
|
|
|
|
|
|
-- new color map
|
|
|
|
---@param args colormap_args
|
|
|
|
---@return graphics_element element, element_id id
|
|
|
|
local function colormap(args)
|
|
|
|
local bkg = "008877FFCCEE114455DD9933BBAA2266"
|
2023-09-29 23:34:10 +00:00
|
|
|
local spaces = string.rep(" ", 32)
|
2022-08-01 16:05:39 +00:00
|
|
|
|
|
|
|
args.width = 32
|
|
|
|
args.height = 1
|
|
|
|
|
|
|
|
-- create new graphics element base object
|
|
|
|
local e = element.new(args)
|
|
|
|
|
|
|
|
-- draw color map
|
2023-09-29 23:34:10 +00:00
|
|
|
function e.redraw()
|
|
|
|
e.w_set_cur(1, 1)
|
|
|
|
e.w_blit(spaces, bkg, bkg)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- initial draw
|
|
|
|
e.redraw()
|
2022-08-01 16:05:39 +00:00
|
|
|
|
2023-05-30 23:51:10 +00:00
|
|
|
return e.complete()
|
2022-08-01 16:05:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return colormap
|