lugre_beam_L.cpp

Go to the documentation of this file.
00001 #include "lugre_prefix.h"
00002 #include "lugre_luabind.h"
00003 #include "lugre_beam.h"
00004 #include "lugre_scripting.h"
00005 #include <string>
00006 
00007 extern "C" {
00008     #include "lua.h"
00009     #include "lauxlib.h"
00010     #include "lualib.h"
00011 }
00012 
00013 namespace Lugre {
00014 
00015 /*
00016 TODO : incomplete, modify cScripting::LuaCall 
00017 so that it can also work on top of stack and use registry to save function param ?
00018 or just implement all interesting mods in a b ig class
00019 */
00020 
00021 
00022 class cBeamFilterComplex : public cSmartPointable { public:
00023     std::string     sLuaFunc;
00024     cBeamPoint      pCur;
00025     cBeamFilterComplex() {}
00026     virtual ~cBeamFilterComplex()   {}
00027     virtual cBeamPoint& CurPoint    (cBeamPoint& p,const int iLine,const int iPoint) { 
00028         pCur = p; 
00029         // MakeChanges(pCur,iLine,iPoint);  TODO, tweak pCur here
00030         return pCur; 
00031     }
00032     virtual cBeamPoint& NextPoint   (cBeamPoint& p,const int iLine,const int iPoint) { return p; }
00033     virtual cBeamPoint& PrevPoint   (cBeamPoint& p,const int iLine,const int iPoint) { return p; }
00034 };
00035 
00036 
00037     
00038 class cBeamFilterComplex_L : public cLuaBind<cBeamFilterComplex> { public:
00040         virtual void RegisterMethods    (lua_State *L) { PROFILE
00041             #define REGISTER_METHOD(methodname) mlMethod.push_back(make_luaL_reg(#methodname,&cBeamFilterComplex_L::methodname));
00042             REGISTER_METHOD(Destroy);
00043             
00044             lua_register(L,"CreateBeamFilter",  &cBeamFilterComplex_L::CreateBeamFilter);
00045         }
00046 
00047     // object methods exported to lua
00048             
00050         static int      Destroy             (lua_State *L) { PROFILE delete checkudata_alive(L); return 0; }
00051         
00052     // static methods exported to lua
00053 
00055         static int      CreateBeamFilter    (lua_State *L) { PROFILE
00056             return CreateUData(L,new cBeamFilterComplex());
00057         }
00058         
00059         virtual const char* GetLuaTypeName () { return "lugre.beamfilter"; }
00060 };
00061 
00063 void    Beam_LuaRegister    (void *L) {
00064     cLuaBind<cBeamFilterComplex>::GetSingletonPtr(new cBeamFilterComplex_L())->LuaRegister((lua_State*) L);
00065 }
00066 
00067 };

Generated on Wed May 23 06:00:13 2012 for cpp by  doxygen 1.5.6