mirror of
https://codeberg.org/1414codeforge/yui.git
synced 2025-06-05 22:19:11 +02:00
[*] Initial commit.
This commit is contained in:
27
core.lua
Normal file
27
core.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local BASE = (...):gsub('core', '')
|
||||
|
||||
local core = { theme = require(BASE..'theme') }
|
||||
core.__index = core
|
||||
|
||||
-- Helpers for drawing
|
||||
function core.verticalOffsetForAlign(valign, font, h)
|
||||
if valign == 'top' then
|
||||
return 0
|
||||
elseif valign == 'bottom' then
|
||||
return h - font:getHeight()
|
||||
end
|
||||
-- else: "middle"
|
||||
return (h - font:getHeight()) / 2
|
||||
end
|
||||
|
||||
function core.drawBox(x,y,w,h, color, cornerRadius)
|
||||
w = math.max(cornerRadius/2, w)
|
||||
if h < cornerRadius/2 then
|
||||
y,h = y - (cornerRadius - h), cornerRadius/2
|
||||
end
|
||||
|
||||
love.graphics.setColor(color.bg)
|
||||
love.graphics.rectangle('fill', x,y, w,h, cornerRadius)
|
||||
end
|
||||
|
||||
return core
|
Reference in New Issue
Block a user