From 76b4fddee6106b60dbc6da6d7bcef61b42a3c310 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 29 Jul 2017 13:53:52 -0400 Subject: Added gui window Bound irrlicht's IGUIWindow to lua --- src/client/lua_api/scene/icamera.cpp | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/client/lua_api/scene/icamera.cpp') diff --git a/src/client/lua_api/scene/icamera.cpp b/src/client/lua_api/scene/icamera.cpp index 5a4e3a2..e53de83 100644 --- a/src/client/lua_api/scene/icamera.cpp +++ b/src/client/lua_api/scene/icamera.cpp @@ -67,6 +67,32 @@ static int newiscenemayacamera(lua_State* L){ return 1; } +static int newiscenefpscamera(lua_State* L){ + printf("createing fps camera!\n"); + int nargs = lua_gettop(L); + ISceneManager* smgr = device->getSceneManager(); + ICameraSceneNode* cam = smgr->addCameraSceneNodeFPS(); + printf("cam is %p",cam); + LISceneNode* lcam = (LISceneNode*)lua_newuserdata(L, sizeof(LISceneNode)); + int tref = luaL_ref(L,LUA_REGISTRYINDEX); + + //Set it's metatable + luaL_getmetatable(L, "scene.iscenefpscamera"); + lua_setmetatable(L, -2); + + //Create the struct + lcam->n = cam; + lcam->funcmap = hashmap_new(); + lcam->type = "iscenefpscamera"; + + //Free up anything made in this function + //free(label); + + //Put it on top and return it + lua_rawgeti(L,LUA_REGISTRYINDEX,tref); + return 1; +} + //iscenecamera.new(Vector position, Vector lookat, parrent) static int newiscenecamera(lua_State* L){ printf("Createing camera!\n"); @@ -155,6 +181,15 @@ static const luaL_reg imayacamera_m[] = { {0,0}, }; +static const luaL_reg ifpscamera_f[] = { + {"new", newiscenefpscamera}, + {0,0}, +}; + +static const luaL_reg ifpscamera_m[] = { + {0,0}, +}; + int icamera_register(lua_State* L, IrrlichtDevice* d){ device = d; @@ -180,6 +215,9 @@ int icamera_register(lua_State* L, IrrlichtDevice* d){ //Start of maya camera luaL_newmetatable(L,"scene.imayacamera"); luaL_register(L,"imayacamera",imayacamera_f); + + luaL_newmetatable(L,"scene.ifpscamera"); + luaL_register(L,"ifpscamera",ifpscamera_f); return 1; } -- cgit v1.2.3-70-g09d2