-
Notifications
You must be signed in to change notification settings - Fork 1
/
override.lua
91 lines (83 loc) · 2.67 KB
/
override.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
--[[
This file simply contains theme-overriding functions
]]
local lg=love.graphics
-- We could @override the previous imgui theme with a custom theme
-- But i'll go for "minimal invasive surgery" (quoted from vrld)
imgui.theme.drawTooltip=function(text,x,y)
x=x-57/2+15
love.graphics.setColor(1,1,1)
x=euler.constrain(x,0,love.graphics.getWidth()-57)
love.graphics.draw(gi.tooltip,x,y-10)
love.graphics.setFont(imgui.theme.current.font)
love.graphics.printf(text,x,y-3,57,'center')
end
imgui.theme.drawScalerHover=function(fraction,vertical,x,y,w,h,style)
if vertical then
lg.setColor(.9,.9,.9)
local sx,sy=w/gi.volumeBG:getWidth(),h/gi.volumeBG:getHeight()
local hh=h
w,h=w/gi.volumeBar:getWidth()+.01,h/gi.volumeBar:getHeight()
lg.draw(gi.volumeBG,x,y,0,sx,sy)
lg.draw(
gi.volumeBar,x,
y+hh*(1-fraction)-(fraction<1 and 2 or 0),
0,
sx,
h*fraction>2.56 and 2.56 or h*fraction
)
lg.draw(gi.volumeKnob,x-2,y+hh*(1-fraction)-(fraction<1 and 2 or 0))
else
lg.setColor(1,1,1)
local sx,sy=w/gi.scalerBG:getWidth(),h/gi.scalerBG:getHeight()
w,h=w/gi.scalerBar:getWidth()+.01,h/gi.scalerBar:getHeight()
lg.draw(gi.scalerBG,x,y,0,sx,sy)
lg.draw(gi.scalerBar,x+1,y,0,w*fraction,sy+.25)
end
end
imgui.theme.drawScalerPressed=function(fraction,vertical,x,y,w,h,style)
if vertical then
lg.setColor(.6,.6,.6)
local sx,sy=w/gi.volumeBG:getWidth(),h/gi.volumeBG:getHeight()
local hh=h
w,h=w/gi.volumeBar:getWidth()+.01,h/gi.volumeBar:getHeight()
lg.draw(gi.volumeBG,x,y,0,sx,sy)
lg.draw(
gi.volumeBar,x,
y+hh*(1-fraction)-(fraction<1 and 2 or 0),
0,
sx,
h*fraction>2.56 and 2.56 or h*fraction
)
lg.draw(gi.volumeKnob,x-2,y+hh*(1-fraction)-(fraction<1 and 2 or 0))
else
lg.setColor(.6,.6,.6)
local sx,sy=w/gi.scalerBG:getWidth(),h/gi.scalerBG:getHeight()
w,h=w/gi.scalerBar:getWidth()+.01,h/gi.scalerBar:getHeight()
lg.draw(gi.scalerBG,x,y,0,sx,sy)
lg.draw(gi.scalerBar,x+1,y,0,w*fraction,sy+.25)
end
end
imgui.theme.drawScalerNormal=function(fraction,vertical,x,y,w,h,style)
if vertical then
lg.setColor(1,1,1)
local sx,sy=w/gi.volumeBG:getWidth(),h/gi.volumeBG:getHeight()
local hh=h
w,h=w/gi.volumeBar:getWidth()+.01,h/gi.volumeBar:getHeight()
lg.draw(gi.volumeBG,x,y,0,sx,sy)
lg.draw(
gi.volumeBar,x,
y+hh*(1-fraction)-(fraction<1 and 2 or 0),
0,
sx,
h*fraction>2.56 and 2.56 or h*fraction
)
lg.draw(gi.volumeKnob,x-2,y+hh*(1-fraction)-(fraction<1 and 2 or 0))
else
lg.setColor(.8,.8,.8)
local sx,sy=w/gi.scalerBG:getWidth(),h/gi.scalerBG:getHeight()
w,h=w/gi.scalerBar:getWidth()+.01,h/gi.scalerBar:getHeight()
lg.draw(gi.scalerBG,x,y,0,sx,sy)
lg.draw(gi.scalerBar,x+1,y,0,w*fraction,sy+.25)
end
end