52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
side = 'right';
};
fatigue = {
icon = lib.image('starlit-ui-alert-fatigue.png');
bg = lib.image('starlit-ui-alert-bg-fatigue.png');
side = 'right';
};
}
starlit.type.user = lib.class {
name = 'starlit:user';
leds = leds;
construct = function(ident)
local name, luser
................................................................................
local v,txt,color,txtcolor,hl,hlcolor = def.measure(luser,def)
v = math.max(0, math.min(1, v))
local n = math.floor(v*16) + 1
local function adjust(img)
return hudAdjustBacklight(lib.image(img)):shift(color or def.color)
end
local img = adjust 'starlit-ui-meter.png'
if def.flipX then
img = img:transform 'FX'
end
img = img:render()
img = img .. '^[verticalframe:17:' .. tostring(17 - n)
if hl then
hl = math.floor(hl*16) + 1
local hi = hudAdjustBacklight(lib.image 'starlit-ui-meter-hl.png')
:shift(hlcolor or def.color)
:render()
hi = hi .. '^[verticalframe:17:' .. tostring(17 - hl)
img = string.format('%s^(%s)', img, hi)
end
img = string.format('%s^(%s)', img, adjust 'starlit-ui-meter-readout.png':render())
luser:hud_change(m.meter, 'text', img)
if txt then
luser:hud_change(m.readout, 'text', txt)
end
if txtcolor then
luser:hud_change(m.readout, 'number', txtcolor:hex())
end
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
side = 'right';
};
fatigue = {
icon = lib.image('starlit-ui-alert-fatigue.png');
bg = lib.image('starlit-ui-alert-bg-fatigue.png');
side = 'right';
};
item = {
icon = lib.image('starlit-ui-alert-item.png');
bg = lib.image('starlit-ui-alert-bg-success.png');
side = 'right';
};
}
starlit.type.user = lib.class {
name = 'starlit:user';
leds = leds;
construct = function(ident)
local name, luser
................................................................................
local v,txt,color,txtcolor,hl,hlcolor = def.measure(luser,def)
v = math.max(0, math.min(1, v))
local n = math.floor(v*16) + 1
local function adjust(img)
return hudAdjustBacklight(lib.image(img)):shift(color or def.color)
end
local img = adjust 'starlit-ui-meter.png'
img = img:render()
img = img .. '^[verticalframe:17:' .. tostring(17 - n)
if hl then
hl = math.floor(hl*16) + 1
local hi = hudAdjustBacklight(lib.image 'starlit-ui-meter-hl.png')
:shift(hlcolor or def.color)
:render()
hi = hi .. '^[verticalframe:17:' .. tostring(17 - hl)
img = string.format('%s^(%s)', img, hi)
end
img = string.format('%s^(%s)', img, adjust 'starlit-ui-meter-readout.png':render())
if def.flipX then
img = img .. '^[transformFX'
end
luser:hud_change(m.meter, 'text', img)
if txt then
luser:hud_change(m.readout, 'text', txt)
end
if txtcolor then
luser:hud_change(m.readout, 'number', txtcolor:hex())
end
|