#62, #63 graphics primatives and added display boxes to renderer

This commit is contained in:
Mikayla Fischler
2022-06-06 15:42:39 -04:00
parent 285026c1fa
commit 8ea75b9501
6 changed files with 353 additions and 12 deletions

73
graphics/core.lua Normal file
View File

@@ -0,0 +1,73 @@
local core = {}
local events = {}
---@class monitor_touch
---@field monitor string
---@field x integer
---@field y integer
---@param monitor string
---@param x integer
---@param y integer
---@return monitor_touch
function events.touch(monitor, x, y)
return {
monitor = monitor,
x = x,
y = y
}
end
core.events = events
local graphics = {}
---@alias TEXT_ALIGN integer
graphics.TEXT_ALIGN = {
LEFT = 1,
CENTER = 2,
RIGHT = 3
}
---@class graphics_frame
---@field x integer
---@field y integer
---@field w integer
---@field h integer
---@param x integer
---@param y integer
---@param w integer
---@param h integer
---@return graphics_frame
function graphics.gframe(x, y, w, h)
return {
x = x,
y = y,
w = w,
h = h
}
end
---@class cpair
---@field fgd color
---@field bkg color
---@field blit_fgd string
---@field blit_bkg string
---@param foreground color
---@param background color
---@return cpair
function graphics.cpair(foreground, background)
return {
fgd = foreground,
bkg = background,
blit_fgd = colors.toBlit(foreground),
blit_bkg = colors.toBlit(background)
}
end
core.graphics = graphics
return core