Howto:Extend Nasal: Difference between revisions

Jump to navigation Jump to search
m
→‎Status (cppbind): forum2wiki: http://forum.flightgear.org/viewtopic.php?f=66&t=21217&p=193362&hilit=cppbind#p193359
m (→‎Status (cppbind): forum2wiki http://forum.flightgear.org/viewtopic.php?f=66&t=21217&p=193362&hilit=cppbind#p193362)
m (→‎Status (cppbind): forum2wiki: http://forum.flightgear.org/viewtopic.php?f=66&t=21217&p=193362&hilit=cppbind#p193359)
Line 12: Line 12:
Most of the code in the Nasal subsystem itself (FGNasalSys) also still uses the legacy C APIs - this is just to explain the two approaches, to avoid unnecessary confusion.
Most of the code in the Nasal subsystem itself (FGNasalSys) also still uses the legacy C APIs - this is just to explain the two approaches, to avoid unnecessary confusion.
Overall, it's a good idea to favor cppbind over the low-level approach documented here, it isn't only much more elegant, but also saves you tons of typing, too   
Overall, it's a good idea to favor cppbind over the low-level approach documented here, it isn't only much more elegant, but also saves you tons of typing, too   
The new cppbind framework makes heavy use of modern C++, so that C++ data structures and classes/methods can now be easily exposed to Nasal space and vice versa.
Implementation examples are to be found in $FG_SRC/Scripting.
For example, see the most recent addition, which exposes SimGear's HTTP client code to Nasal space with less than 140 lines of code in $FG_SRC/Scripting/NasalHTTP.?xx
There's still plenty of "old" code that doesn't yet use the cppbind framework - check the header inclusions at the top of the file.


Some of the more straightforward things to play with would be exposing useful SG/FG classes to Nasal space, such as the SGSubsystem interface to register scripted SGSubsystems, or the autopilot system.
Some of the more straightforward things to play with would be exposing useful SG/FG classes to Nasal space, such as the SGSubsystem interface to register scripted SGSubsystems, or the autopilot system.

Navigation menu