Air Manager Gauges Stand-Alone

Gauge Composer / Project Magenta / Reality XP, FlightDecksoft, etc...

Re: Air Manager Gauges Stand-Alone

Messagede arcc » Dim 21 Fév 2016 12:10

Bonjour à tous

Je suis en train de refaire(à partir d'une gauge existante dans Air manager) un altimètre pour mon Twin Otter.
J'ai refais le fond avec Inkscape (par ailleurs merci pour vos conseils http://www.aircockpit.com/viewtopic.php?f=35&t=5241)
Je butte sur une petite chose.
Pour afficher l'altitude en texte, j'ai cette phrase qui fonctionne.
Code: Tout sélectionner
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)


Cela m'affiche les trois chiffres (Dizaine de milliers, Milliers et centaines de pieds les deux autres chiffres de l'altitude étant fixe 00.) Par exemple pour 11500 feets j'ai bien d'affiché 115 00.
Mon problème est de pouvoir écarter les chiffres 150 (avoir plus d'espace entre le 1 le 5 et le 0) et ca je n'arrive pas.
Ai je été clair, pas sur...

A+
Christian
Un ancien sous-marinier qui a pris de la hauteur.
Avatar de l’utilisateur
arcc
 
Messages: 715
Inscription: 16/12/13
Localisation: La ou fini la terre (Finistere)

Re: Air Manager Gauges Stand-Alone

Messagede sikorsky77 » Dim 21 Fév 2016 15:29

Salut Christian

la commande txt_add n'assure pas le formattage des nombres
elle definit une variable texte avec
- le formattage du texte (police utlisée , taille , en gras , en italique , soulignée, etc..)
- son affichage vertical et horizontal
- le positonnement de la zone de texte au sein de la gauge

le formattage d'un nombre est quand à lui assuré par une commande LUA de formattage

peux-tu m'envoyer le script complet que je regarde et que je te propose une solution

Sikorsky77
Thierry
Avatar de l’utilisateur
sikorsky77
 
Messages: 168
Inscription: 15/11/09
Localisation: 77 Boissy Le Chatel Proche aerodrome Coulommiers Mouroux

Re: Air Manager Gauges Stand-Alone

Messagede sikorsky77 » Dim 21 Fév 2016 16:10

Salut Christian

la commande txt_add n'assure pas le formattage des nombres
elle definit une variable texte avec
- le formattage du texte (police utlisée , taille , en gras , en italique , soulignée, etc..)
- son affichage vertical et horizontal
- le positonnement de la zone de texte au sein de la gauge

le formattage d'un nombre est quand à lui assuré par une commande LUA de formattage

peux-tu m'envoyer le script complet que je regarde et que je te propose une solution

Sikorsky77
Thierry
Avatar de l’utilisateur
sikorsky77
 
Messages: 168
Inscription: 15/11/09
Localisation: 77 Boissy Le Chatel Proche aerodrome Coulommiers Mouroux

Re: Air Manager Gauges Stand-Alone

Messagede arcc » Dim 21 Fév 2016 16:30

Merci Thierry pour ta réponse rapide.

Pour comprendre un peu le fonctionnement,je suis parti de la gauge "Altimeter" du Baron 58 de Air manager.
J'ai remplacer le fond par celui du Twin Otter
J'ai ensuite reussi à replacer les textes du Barometre
puis j'ai replacer celui de l'altitude et comme tu peux voir les trois chiffres sont trop collés.

Comme tu peux remarquer, normalement les chiffre devraient defiler de haut en bas, mais j'essaierai de comprendre le fonctionnement plus tard. Pour l'instant cela sera très bien comme ca.

Image

Code: Tout sélectionner
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
   
    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)


A+
Christian
Un ancien sous-marinier qui a pris de la hauteur.
Avatar de l’utilisateur
arcc
 
Messages: 715
Inscription: 16/12/13
Localisation: La ou fini la terre (Finistere)

Re: Air Manager Gauges Stand-Alone

Messagede 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)
Avatar de l’utilisateur
sikorsky77
 
Messages: 168
Inscription: 15/11/09
Localisation: 77 Boissy Le Chatel Proche aerodrome Coulommiers Mouroux

Re: Air Manager Gauges Stand-Alone

Messagede JacquesZ » Lun 22 Fév 2016 00:51

Je complète le script malin de Thierry qui isole chaque digit:

Maintenant que chaque "Digit" est isolé dizaine de milliers, milliers, centaines de pieds, tu peux les positionner individuellement au pixel près.
Si tu crées une boîte d'affichage par "digit" avec text_add, tu les mets où tu veux.
Pour le défilement vertical, c'est le même genre, je teste et je te dis ça
Code: Tout sélectionner
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)

--   On crée une boite d'affichage par digit, qu'on pourra positionner en x,y, largeur 60 à 70 à tester...
txt_alt10k = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 96, 168, 70, 65)
txt_altk = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 166, 168, 70, 65)
txt_altcentaine = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 236, 168, 70, 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_Unit = 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_alt10k , Diz_Millier_Unit)
txt_set(txt_altk, Millier_Unit)
txt_set(txt_altcentaine, Centaine_Unit)

--txt_set(txt_altk, string.format("%03d",var_round(altitude/100,0)*1 ) )
--txt_set(txt_inhg, string.format("%.04f", pressure) )

txt_set(txt_inhg, string.format("%.02d.%.02d", pressure, (pressure*100)%100 ) )
txt_set(txt_hpa, string.format("%04d",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)
Ma chaîne YouTube Tutos sur l’A320 par un Pilote de Ligne: https://youtube.com/channel/UCljftuoKBcgeR-WBgYJpuoA
Avatar de l’utilisateur
JacquesZ
 
Messages: 2848
Inscription: 24/11/10

Re: Air Manager Gauges Stand-Alone

Messagede sikorsky77 » Lun 22 Fév 2016 01:01

Merci et Exact JacquesZ

il faut utiliser les fonctions de Running_text_id

je n'ai ps eu le temps de me pencher sur le code
Avatar de l’utilisateur
sikorsky77
 
Messages: 168
Inscription: 15/11/09
Localisation: 77 Boissy Le Chatel Proche aerodrome Coulommiers Mouroux

Re: Air Manager Gauges Stand-Alone

Messagede JacquesZ » Lun 22 Fév 2016 03:38

avec les digits déroulants, c'est plus compliqué, toujours basé sur le script de Thierry:

La position des boites déroulantes doit être calée au pixel près.
le code est commenté.
Code: Tout sélectionner
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, 321, 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;", 120, 321, 120, 40)
txt_alt10k = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 96, 148, 70, 65)
txt_altk = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 166, 148, 70, 65)
txt_altcentaine = txt_add("", "-fx-font-family:\"Lucida sans\"; -fx-font-size:50px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;", 236, 148, 70, 65)

-- création d'une fonction qui met le texte en forme (éventuellement) et est utilisée par "running_txt_add_ver"
function altitude_callback(i)
if i == 0 then
   return"0"
else
   return string.format("%s", i  )
end
end
-- affichage de la dizaine de milliers de ft en 40 px de hauteur à x,y=116,115 en trois étapes
-- etape 1 création d'un affichage vertical de 3 chiffres pour un effet "rouleau". On les déclare comme étant de 37 pixels de haut pour qu'ils soient le plus serrés possible 
rtxt_alt10k=running_txt_add_ver(166,115,3,55,37,altitude_callback,"-fx-font-family:\"Arial\"; -fx-font-size:40px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;")
-- etape 2: on affiche pour commencer le chiffre 0 au milieu du bandeau vertical de 3 chiffres
running_txt_move_carot(rtxt_alt10k, 0)
-- etape 3: on crée une fenêtre qui limite l'affichage à 2 caractères de haut, centré sur le bandeau, ce qui n'affiche qu'une partie des chiffres avant et après (ici x:166, y:115+moitié de la hauteur du caractère=143, largeur, hauteur=2*hauteur caractère)
running_txt_viewport_rect(rtxt_alt10k,166,143,55,74)

-- idem pour les milliers de ft, avec une police plus petite
rtxt_altk=running_txt_add_ver(216,129,3,55,29,altitude_callback,"-fx-font-family:\"Arial\"; -fx-font-size:33px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;")
running_txt_move_carot(rtxt_altk, 0)
running_txt_viewport_rect(rtxt_altk,216,155,55,45)

-- idem pour les centaines de ft, avec une police plus petite
rtxt_altcentaine=running_txt_add_ver(246,129,3,55,29,altitude_callback,"-fx-font-family:\"Arial\"; -fx-font-size:33px; -fx-fill: white; -fx-font-weight:bold; -fx-text-alignment: RIGHT;")
running_txt_move_carot(rtxt_altcentaine, 0)
running_txt_viewport_rect(rtxt_altcentaine,246,155,55,45)

-- on affiche les aiguilles APRES les digits pour un meilleur rendu
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 avec defilement -------------------------------------------------------------------------------------------
if altitude >=10000 then
Diz_Millier_Unit = 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)

-- txt_set (txt_alt10k , Diz_Millier_Unit)
--txt_set(txt_altk, Millier_Unit)
--txt_set(txt_altcentaine, Centaine_Unit.. " 00")

-- affichage dans les bandeaux de trois chiffres déroulants définis auparavant du digit extrait correspondant à l'altitude
running_txt_move_carot(rtxt_alt10k, Diz_Millier_Unit)
running_txt_move_carot(rtxt_altk, Millier_Unit)
running_txt_move_carot(rtxt_altcentaine, Centaine_Unit)


--txt_set(txt_altk, string.format("%03d",var_round(altitude/100,0)*1 ) )
--txt_set(txt_inhg, string.format("%.04f", pressure) )
txt_set(txt_inhg, string.format("%.02d.%.02d", pressure, (pressure*100)%100 ) )
txt_set(txt_hpa, string.format("%04d",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)


Après y'a plus fort avec des images qui imitent des rouleaux, mais je sais pas faire!
Tu peux regarder le code de l'altimètre de l'Eurocopter EC135 comme base.

Jacques
Ma chaîne YouTube Tutos sur l’A320 par un Pilote de Ligne: https://youtube.com/channel/UCljftuoKBcgeR-WBgYJpuoA
Avatar de l’utilisateur
JacquesZ
 
Messages: 2848
Inscription: 24/11/10

Re: Air Manager Gauges Stand-Alone

Messagede sikorsky77 » Lun 22 Fév 2016 14:58

Bon boulot Jacques
Avatar de l’utilisateur
sikorsky77
 
Messages: 168
Inscription: 15/11/09
Localisation: 77 Boissy Le Chatel Proche aerodrome Coulommiers Mouroux

Re: Air Manager Gauges Stand-Alone

Messagede arcc » Lun 22 Fév 2016 17:11

Alors la merci bien à vous deux.
Je vais essayer tous ca et je reviens vers vous.

Encore merci

Christian
Un ancien sous-marinier qui a pris de la hauteur.
Avatar de l’utilisateur
arcc
 
Messages: 715
Inscription: 16/12/13
Localisation: La ou fini la terre (Finistere)

PrécédenteSuivante

Retourner vers Add-Ons d'instruments sur un ou plusieurs PC





Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 28 invités