drawTextBox to use style table instead of a lot of arguments
This commit is contained in:
parent
3c1746d914
commit
1883bcd78b
14
code/ui.lua
14
code/ui.lua
@ -5,13 +5,19 @@ function addElement(self)
|
||||
self.id = #UIElement
|
||||
end
|
||||
|
||||
function drawTextBox(text,x,y,color,background_color)
|
||||
local color = color or {1,1,1,1}
|
||||
local background_color = background_color or {0,0,0,1}
|
||||
function drawTextBox(text,x,y,style)
|
||||
local style = style or {}
|
||||
local c1, c2, c3, a = love.graphics.getColor()
|
||||
local width = locale_font:getWidth(text)
|
||||
local height = locale_font:getHeight(text)
|
||||
local margin = 5
|
||||
|
||||
local color = style.color or {1,1,1,1}
|
||||
local background_color = style.background_color or {0,0,0,1}
|
||||
local margin = style.margin or 5
|
||||
local rotation = style.rotation or 0
|
||||
local sx = style.sx or 1
|
||||
local sy = style.sy or style.sx
|
||||
|
||||
local lines = 1
|
||||
for i in text:gmatch("\n") do
|
||||
lines = lines + 1
|
||||
|
@ -62,8 +62,10 @@ function Prompt:draw()
|
||||
self.name .. ": " .. self.input,
|
||||
self.pos.x,
|
||||
self.pos.y,
|
||||
self.color,
|
||||
self.background_color
|
||||
{
|
||||
color = self.color,
|
||||
background_color = self.background_color
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user