prompt box style, entity prompts improvement, killing entities and particles improvement

This commit is contained in:
lustlion
2022-03-11 13:04:36 +01:00
parent 8c8e4808ad
commit 96b1e750e4
6 changed files with 66 additions and 22 deletions

View File

@@ -20,7 +20,8 @@ Prompt = {
name = "input",
canceled = false,
closing = false,
color = {1,1,1,1},
background_color = {0,0,0,1},
active_prompt = nil,
}
@@ -52,7 +53,28 @@ function Prompt:textinput(text)
end
function Prompt:draw()
love.graphics.print(self.name .. ": " .. self.input, self.pos.x, self.pos.y)
local c1, c2, c3, a = love.graphics.getColor()
local text = self.name .. ": " .. self.input
local width = locale_font:getWidth(text)
local height = locale_font:getHeight(text)
local margin = 10
love.graphics.setColor(unpack(self.color))
love.graphics.rectangle("fill",
self.pos.x-margin-1,
self.pos.y-1,
width+margin*2+2,
height+margin+2
)
love.graphics.setColor(unpack(self.background_color))
love.graphics.rectangle("fill",
self.pos.x-margin,
self.pos.y,
width+margin*2,
height+margin
)
love.graphics.setColor(unpack(self.color))
love.graphics.print(text, self.pos.x, self.pos.y)
love.graphics.setColor(c1,c2,c3,a)
end
function Prompt:activate()