wkitty42 wrote in Wed Jun 06, 2018 5:24 pm:part of this be due to the work being done to remove PUI and replace it with something modern and future-proof... part of the work, as i understand it, is ""conversion wrappers"" that take the PUI calls and convert them to the new stuff... this way folks are not hampered by the changes and their existing PUI code and menus will still work... later the wrappers may be removed and the whole new system exposed so that devs can (finally) switch to the new methods... by then, PUI should be gone... it hasn't been maintained or updated in a long time...
James Turner wrote:https://sourceforge.net/p/flightgear/ma ... /36399261/
I would recommend:
- replace the HUD (HUD.cxx and related code) with a Canvas implementation. This is a confusing scheme, since we have ‘old’ and ‘new’ C++ HUDs (but I recall I unified their rendering some years ago), and some aircraft already using ‘custom Canvas HUDs’, i.e totally independent of the ‘built-in’ HUD.
To be clear, this is the HUD you get by pressing ‘h’ key in the sim. It’s configured by an XML file: FG_DATA/Huds/default.xml - and you can see in that directory, other configs are possible - the ‘new C++ HUD’ layer allows arbitrary placement of HUD elements defined by these XML.
Some* aircraft, but I don’t know how many, use the C++ HUD system, but replace the default HUD with their own - see the F16 example file also in FG_DATA/Huds for example.
The aim would be to replace the C++ code with a Nasal HUD layer, likely in FG_DATA/Canvas/Hud - with one Canvas HUD item per each of the current C++ HUD items (ladder, tape, dial etc). Each one should be fairly easy to build with some path, text and group commands.
Then we need to write an XML loader in Nasal, possibly one line of C++ to trigger loading, and we can remove the C++ HUD code in favour of the Canvas implementation.
Of course, probably it’s not so simple but this is the concept!
https://sourceforge.net/p/flightgear/ma ... /36401850/
If the new impl defines each HUD component with the same features as the C++ implementation, it should work as a drop-in replacement for the old system. (Honestly it may be the case that some features supported in C++ are not used by any aircraft out there, but as ever with FG, we have no way to capture the set of in-use features).
If you look at say HUD_tape.cxx - which is one of the more complex ones - it’s some fairly ‘simple’ (but verbose) code to draw either a horizontal or vertical tape. Mostly it comes down to many draw_line calls which ultimately do the OpenGL - you can replace the draw_line calls in a Nasal version with appending a moveTo,lineTo onto a Canvas path.
And the constructor for HUD::Tape::Tape shows you the XML config properties for the tape which are supported.
[...]
Once we are happy that the Canvas impl works correctly, it should be visually identical to what we have now, and the native impl can be dropped.
https://sourceforge.net/p/flightgear/ma ... /36406449/
if we are to move beyond the legacy C++ code, we need a layer (in Nasal or C++) that parses the existing HUID XML, and looks/works close-to-identical to the current version.
https://sourceforge.net/p/flightgear/ma ... /36401971/
There’s nothing per-se about doing a HUD via Canvas, that requires this - I’m guessing the Canvas-HUD-that-replaces-the-C++-one would appear the same way Canvas tooltips / popups do. (or Canvas dialogs, or…)
Users browsing this forum: No registered users and 2 guests