-- $LastChangedDate: 2010-04-16 23:43:07 -0400 (Fri, 16 Apr 2010) $
-- Macros written in Lua to expand C++ code for bindings between C++/Lua.
-- Avoid lua_/LUA_ which is reserved by Lua.

bindTable = {

class = "OtwViewpoint",
typesig = "TYPESIG_OTW_VIEWPOINT",
luaCanInstantiate = true,

headers =
[[
#include "base/module.hh"
using namespace base;
#include "view/module.hh"
#include "view/viewpoint_otw.hh"
#include "view/observer_current_craft.hh"
using namespace view;
]],

func_New = {
    comments = "OtwViewpoint:New(Observer)",
    code = [[
        // Create OTW Viewpoint with Observer.
        shptr<Observer> observer = POP_USERDATA_AS_SHPTR<Observer>( L );
        CHECK_TYPESIG(observer,TYPESIG_OBSERVER);
        shptr<OtwViewpoint> viewpoint = new OtwViewpoint( observer );
        return NEW_USERDATA_SHPTR<OtwViewpoint>( L, viewpoint, BIND_METATABLE_NAME );
    ]]
},

func_Destroy = {
    comments = "Lua's garbage collector indirectly invokes this C++ destructor.",
    code = [[
        return DESTROY_USERDATA_SHPTR<OtwViewpoint>( L, CheckTypesigOtwViewpoint );
    ]]
},

func_SetOtwMode = {
    comments = "OtwViewpoint:SetOtwMode( OTW_FRONT|REAR|LEFT|RIGHT )",
    code = [[
        const OtwViewpoint::eOtwMode otwMode = static_cast<OtwViewpoint::eOtwMode>( POP_INT( L ) );
        shptr<OtwViewpoint> viewpoint = POP_USERDATA_AS_SHPTR<OtwViewpoint>( L );
        CHECK_TYPESIG(viewpoint,TYPESIG_OTW_VIEWPOINT);
        viewpoint->SetOtwMode( otwMode );
    ]]
},

}
