aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/scene
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-07-29 13:53:52 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-07-29 13:53:52 -0400
commit76b4fddee6106b60dbc6da6d7bcef61b42a3c310 (patch)
tree7c98499a8d32d6415a6cfb5f318943c744778172 /src/client/lua_api/scene
parentfa49161fe2d7e0a025c9fd8559815d56dfd1f427 (diff)
downloadbrokengine-76b4fddee6106b60dbc6da6d7bcef61b42a3c310.tar.gz
brokengine-76b4fddee6106b60dbc6da6d7bcef61b42a3c310.tar.bz2
brokengine-76b4fddee6106b60dbc6da6d7bcef61b42a3c310.zip
Added gui window
Bound irrlicht's IGUIWindow to lua
Diffstat (limited to 'src/client/lua_api/scene')
-rw-r--r--src/client/lua_api/scene/icamera.cpp38
1 files changed, 38 insertions, 0 deletions
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;
}