lzkd 在问下miniwindow
我看你的函数,看的到miniwindow部分代码。但是好像没有调用 function draw_window () 这个函数,那么小窗口是真么画处理啊的?
弱弱的问下。可以解答不? get_dbr 这个函数里调用了draw_window()
另外,我建了一个定时器,5秒刷一次,调用了draw_window() 同意楼上发言,建议转楼主处理 ok 这个函数已经搞明白了。
但是有个可以画百分比的。draw_line 是什么东西? function draw_line (iLine, sPrompt, iCurrent, iMax, sGoodColour, sBadColour, sOverColour)
-- draw the Text
local left1 = EDGE_WIDTH + 4
local left2 = left1 + 40
local left3 = left2 + 185
local top = (EDGE_WIDTH + 3) + (font_height+2)*(iLine-1)
local text_colour = WINDOW_TEXT_COLOUR
local text1 = sPrompt
--Note ( text1)
WindowText (win, "f1", text1, left1, top, 0, 0, text_colour, true)
-- adjust different font height in one line
local top1 = top - 1
--draw the background colour of the bar
local back_colour =ColourNameToRGB("dimgray")
WindowText (win, "f2", "gggggggggggg", left2, top1, 0, 0, back_colour, true)
if iCurrent == "" or iMax == "" then
iCurrent = 0
iMax = 0
end -- if
percent = math.floor(iCurrent/(iMax/12))
--Below 25% warn by using different colour, or above 100% using another different colour
if percent < 3 then
active_colour= ColourNameToRGB(sBadColour)
elseif percent > 12 then
percent = 12
active_colour = ColourNameToRGB(sOverColour)
else
active_colour = ColourNameToRGB(sGoodColour)
end -- if
--Draw active part of gauge
for count = 0,percent do
if count == 0 then
bar = ""
else
bar = bar.. "g"
end -- if
end -- for
if bar == nil then
bar = ""
end -- if
WindowText (win, "f2", bar, left2, top1, 0, 0, active_colour, true)
local text3 = iCurrent.. "/".. iMax
WindowText (win, "f3", text3, left3, top, 0, 0, active_colour, true)
-- end draw the Text Line
end -- draw line 貌似这个更有意思。研究研究 恩。基本明白了。fool
页:
[1]