de sikorsky77 » Dim 21 Fév 2016 21:12
salut christian
essaye ça
-----------------------------------------------------------------------------------------------------------------------------------------------
img_add_fullscreen("altimeter_backdrop.png")
txt_inhg = txt_add("00.00", "-fx-font-family:\"Lucida sans\"; -fx-font-size:30px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: CENTER;", 270, 341, 120, 40)
txt_hpa = txt_add("0000", "-fx-font-family:\"Lucida sans\"; -fx-font-size:30px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: CENTER;", 132, 341, 120, 40)
txt_altk = txt_add("", "-fx-font-family:\"Arial\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: CENTER;", 96, 168, 200, 65)
img_small_neddle = img_add_fullscreen("altimeter_small_neddle.png")
img_big_neddle = img_add_fullscreen("altimeter_big_neddle.png")
img_add_fullscreen("altimeter_center.png")
function PT_altimeter(altitude, pressure)
h = ( (altitude - math.floor(altitude/10000)*10000)/1000 )*36
t = ( altitude - math.floor(altitude/10000)*10000 )*0.36
img_rotate(img_small_neddle, h)
img_rotate(img_big_neddle, t)
hh = h/36
tt = t/0.36-hh*1000
--- texte simple sans defilement -------------------------------------------------------------------------------------------
if altitude >=10000 then
Diz_Millier = tostring(altitude - math.fmod(altitude , 10000)) / 10000)
else
Diz_Millier_Unit = " "
end
Millier = math.fmod(altitude , 10000)
if altitude >= 1000 then
Millier_Unit = tostring((Millier - math.fmod(Millier , 1000)) / 1000)
else
Millier_Unit = " "
end
Centaine = math.fmod(Millier , 1000)
Centaine_Unit = tostring((Centaine - math.fmod(Centaine , 100)) / 100) .. " 00"
txt_set (txt_altk , Diz_Millier_Unit .. " ".. Millier_Unit .. " " .. Centaine_Unit)
-- txt_set(txt_altk, string.format("%03d",var_round(altitude/100,0)*1 ) )
--txt_set(txt_inhg, string.format("%.02f", pressure) )
txt_set(txt_inhg, string.format("%.02d.%.02d", pressure, (pressure*100)%100 ) )
txt_set(txt_hpa, string.format("%02d",pressure * 33.8639) )
end
xpl_dataref_subscribe("sim/cockpit2/gauges/indicators/altitude_ft_pilot", "FLOAT",
"sim/cockpit/misc/barometer_setting", "FLOAT", PT_altimeter)
fsx_variable_subscribe("INDICATED ALTITUDE", "Feet",
"KOHLSMAN SETTING HG", "inHg", PT_altimeter)