local batteryBoxWidth = scale(80)
local batteryBoxHeight = ers_arrow_h
ui.setCursor(vec2(
fuel_arc_pos_x - (batteryBoxWidth / 2),
ers_arrow_pos_y
))
-- if available battery less than 20%, show in red color
local textColor = rgbm(1, 1, 1, 1)
if (CAR.kersCharge or 0) < 0.2 then
textColor = rgbm(1, 0.5, 0, 1)
end
ui.pushDWriteFont('MyFont:\\fonts;Weight=Regular')
ui.dwriteTextAligned(
string.format("%.0f", (CAR.kersCharge or 0) * 100),
scale(22),
ui.Alignment.Center,
ui.Alignment.Center,
vec2(batteryBoxWidth, batteryBoxHeight),
false,
textColor
)
ui.popDWriteFont()