-- $LastChangedDate: 2011-03-17 19:59:52 -0400 (Thu, 17 Mar 2011) $
-- Macros written in Lua to expand C++ code for bindings between C++/Lua.
-- Avoid lua_/LUA_ which is reserved by Lua.

bindTable = {

class = "Window",
typesig = nil,
luaCanInstantiate = false,

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

func_GetWindowSize = {
    comments = "w,h Window:GetWindowSize()",
    code = [[
        const WidthHeight<int> wh = GET_WINDOW().GetWindowSize();
        lua_pushnumber( L, wh.w );
        lua_pushnumber( L, wh.h );
        return 2;  // stack items to return
    ]]
},

func_GetMainView = {
    comments = "View Window:GetMainView()",
    code = [[
        shptr<View> view = GET_WINDOW().GetMainView();
        return NEW_USERDATA_SHPTR<View>( L, view, LUABIND_METATABLE_STRING("View") );
    ]]
},

func_GetFPS = {
    comments = "Window:GetFPS()",
    code = [[
        lua_pushnumber( L, GET_WINDOW().GetFPS() );
        return 1;  // stack items to return
    ]]
},

func_SaveViewpoint = {
    comments = "bool Window:SaveViewpoint()",
    code = [[
        lua_pushboolean( L, GET_WINDOW().SaveViewpoint() );
        return 1;  // stack items to return
    ]]
},

func_RestoreViewpoint = {
    comments = "bool Window:RestoreViewpoint()",
    code = [[
        lua_pushboolean( L, GET_WINDOW().RestoreViewpoint() );
        return 1;  // stack items to return
    ]]
},

}
