Nasal/CppBind: Difference between revisions

Jump to navigation Jump to search
m (can't contribute right now, but I will at least wrap your comments if you won't ;)
Line 58: Line 58:


Let's create the NasalDemo.hxx header file first:
Let's create the NasalDemo.hxx header file first:
<syntaxhighlight lang="cpp" enclose="div">
// NasalDemo.hxx
#ifndef SCRIPTING_NASAL_DEMO_HXX
#define SCRIPTING_NASAL_DEMO_HXX
#include <simgear/nasal/nasal.h>
naRef initNasalDemo(naRef globals, naContext c);
#endif // of SCRIPTING_NASAL_DEMO_HXX
</syntaxhighlight>
Next, open $FG_SRC/Scripting/NasalSys.cxx and locate the FGNasalSys::init() method, to call the new initNasalDemo(), add this to the bottom of the function:
<syntaxhighlight lang="cpp" enclose="div">
if( !NasalDemo::isInit() )
initNasalDemo(_globals, _context);
</syntaxhighlight>
Next, we can create the NasalDemo.cxx file


<syntaxhighlight lang="cpp" enclose="div">
<syntaxhighlight lang="cpp" enclose="div">
Line 63: Line 82:
#include <Main/util.hxx>
#include <Main/util.hxx>


// $FG_SRC/Scripting/NasalTest.cxx
// $FG_SRC/Scripting/NasalDemo.cxx
   
   
#include <simgear/nasal/cppbind/from_nasal.hxx>
#include <simgear/nasal/cppbind/from_nasal.hxx>

Navigation menu