Board index FlightGear Development Canvas

Changing text and translation in one frame.

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Changing text and translation in one frame.

Postby Soitanen » Sun Oct 08, 2017 5:22 pm

I have modifying Canvas PFD from Gijs 747 to my 737. I decided to make possible normal indication of negative altitude and faced some problems. In 738 last altitude digit's values will revert upside down to represent negative altitude. I created scheme like this:
Code: Select all
   de
   de
ABCDE
   de

I change "de" part (next de is + or - 20 ft) and then move whole DE column to correct vertical position. Here is my code:
Code: Select all
      var altR20 = roundToNearest(alt, 20);
      me["curAltDig45High2"].setText(sprintf("%02d",math.mod(math.abs(altR20+20),100)));
      me["curAltDig45High1"].setText(sprintf("%02d",math.mod(math.abs(altR20),100)));
      me["curAltDig45Low1"].setText(sprintf("%02d",math.mod(math.abs(altR20-20),100)));
      me["curAltDig45Low2"].updateText(sprintf("%02d",math.mod(math.abs(altR20-40),100)));
      me["curAltDig45"].setTranslation(0,((alt - altR20)/20*36.31));

The problem is, that sometimes value change and translation occurs not in one frame, but in two different and I see, like jumping column.
I tried to make me["curAltDig45"].hide(); before this piece of code and me["curAltDig45"].show(); after, but problem still exist. How can I solve this issue?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Changing text and translation in one frame.

Postby nepcia » Fri Oct 27, 2017 3:17 pm

Hi,
I’ve noticed the same problem during HUD development. From what I've seen, it happens only when framerate drops below canvas update rate. I've also tried to record my screen to see it frame by frame and I looks like sometimes translation of text happens before any text or visibility change irrespective of their order in nasal code. Have you managed to develop any kind of workaround because it can be quite irritating?
Marcin
nepcia
 
Posts: 10
Joined: Sat May 13, 2017 5:27 pm

Re: Changing text and translation in one frame.

Postby Soitanen » Fri Oct 27, 2017 3:31 pm

Unfortunately I still haven't any solution and use old scheme with"sometimes blinking numbers".
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Changing text and translation in one frame.

Postby Necolatis » Fri Oct 27, 2017 4:32 pm

me["curAltDig45"].update();

:)
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore


Hangar: https://sites.google.com/site/fghangar/
User avatar
Necolatis
 
Posts: 1917
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.1
OS: Windows 10

Re: Changing text and translation in one frame.

Postby Soitanen » Fri Oct 27, 2017 6:34 pm

Necolatis, thank you, I'll try this.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 6:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Changing text and translation in one frame.

Postby nepcia » Fri Oct 27, 2017 8:10 pm

It works like a charm, thank you Necolatis :)
Marcin
nepcia
 
Posts: 10
Joined: Sat May 13, 2017 5:27 pm


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest