-
Notifications
You must be signed in to change notification settings - Fork 17
/
entitytooltip.lua
32 lines (27 loc) · 1.04 KB
/
entitytooltip.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
entitytooltip = class("entitytooltip")
local theight = 64
local twidth = 64
local descwidth = 0
twidth = twidth + descwidth*8
function entitytooltip:init(ent)
self.ent = ent
end
function entitytooltip:update(dt)
self.x = math.min(mouse.getX(), width*16*scale-(twidth+4)*scale)
self.y = math.max(0, mouse.getY()-(theight+4)*scale)
end
function entitytooltip:draw(a)
if tooltipimages[self.ent.i] then
love.graphics.setColor(1, 1, 1, a)
properprintbackground(self.ent.t, self.x, self.y, true)
love.graphics.setColor(0, 0, 0, a)
drawrectangle(self.x/scale, self.y/scale+8, (twidth+4), (theight+4))
love.graphics.setColor(1, 1, 1, a)
drawrectangle(self.x/scale+1, self.y/scale+9, 66, theight+2)
local r, g, b = love.graphics.getBackgroundColor()
love.graphics.setColor(r, g, b, a)
love.graphics.rectangle("fill", self.x+2*scale, self.y+10*scale, 64*scale, 64*scale)
love.graphics.setColor(1, 1, 1, a)
love.graphics.draw(tooltipimages[self.ent.i], self.x+2*scale, self.y+10*scale, 0, scale, scale)
end
end