Here's the LEO version to set the global fw variable in LUA (LuaTools is not part of LEO, but it inherits LEO's Lua class, so you have to copy this code to your program):
class LuaTools : public Lua
{
public:
int GetStackSize()
{
return GetTop();
}
void SetStackSize( int size )
{
int currentsize = GetStackSize();
if( size<currentsize )
Pop( currentsize-size );
}
void SetScriptObject( const std::string& name, BP o )
{
int size = GetStackSize();
PushObject( o );
SetGlobal( name );
SetStackSize( size );
}
};
Then you can load a whole scene without any need for processcene (water, skybox, lights, everything works):
#include "leo.h"
using namespace LEO;
int main()
{
Engine engine;
Framework fw;
engine.Create("Integrated Framework Demo",640,480);
fw.Create();
LuaTools luat;
luat.Create();
luat.SetScriptObject("fw",fw);
fw.SetStats(2);
Scene scene;
scene.Load("abstract::main.sbx");
fw.main.GetCamera().Move(-10,140,30);
fw.main.GetCamera().Turn(0,180,0);
while( !Keyboard::I****() && !engine.IsTerminated() )
{
fw.Update();
fw.Render();
engine.Flip(0);
}
fw.Free();
return engine.Free();
}