/*This file defines some things that all igui stuff can do*/ extern "C" { #include #include #include } #include #include "igeneric.hpp" #include "../gameparts.hpp" #include "../../../shared/lua_api/common.h" using namespace irr; using namespace core; using namespace scene; using namespace video; extern IrrlichtDevice* device; /* static LISceneNode* toiscenenode(lua_State* L, int index){ LISceneNode* ret = (LISceneNode*)lua_touserdata(L,index); if(ret == NULL) luaL_typerror(L,index,"LISceneNode"); return ret; } */ int iscenegetpos(lua_State* L){//{node=ud_IMeshSceneNode} lua_getfield(L,-1,"node");//{node=ud_IMeshSceneNode},ud_IMeshSceneNode ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_IMeshSceneNode},ud_IMeshSceneNode vector3df pos = i->getAbsolutePosition(); lua_pop(L,2); pushvector3d(L,pos.X,pos.Y,pos.Z); return 1; } int iscenesetpos(lua_State* L){//{node=ud_IMeshSceneNode},{x,y,z} double x,y,z; popvector3d(L,&x,&y,&z);//{node=ud_IMeshSceneNode} lua_getfield(L,-1,"node");//{node=ud_IMeshSceneNode},ud_IMeshSceneNode ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1);//{node=ud_IMeshSceneNode},ud_IMeshSceneNode i->setPosition(vector3df(x,y,z)); i->updateAbsolutePosition(); vector3df pos = i->getAbsolutePosition(); //printf("After setting pos, new pos is %f %f %f",pos.X,pos.Y,pos.Z); lua_pop(L,2);// return 0; } int iscenegetangle(lua_State* L){//{node=ud-IMeshSceneNode} lua_getfield(L,-1,"node"); ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1); irr::core::vector3df ang = i->getRotation(); pushvector3d(L,ang.X, ang.Y, ang.Z); return 1; } int iscenesetangle(lua_State* L){//{node=ud_ISceneNode},{x,y,z} double x,y,z; popvector3d(L,&x,&y,&z); lua_getfield(L,-1,"node"); ISceneNode* i = (ISceneNode*)lua_touserdata(L,-1); irr::core::vector3df ang = irr::core::vector3df(x,y,z); i->setRotation(ang); return 0; } /* int iscenesetmaterial(lua_State* L){ ISceneNode* i = toiscenenode(L,1)->n; const char* s = luaL_optstring(L,2,"error.png"); printf("Setting material to %s",s); IVideoDriver* driver = device->getVideoDriver(); i->setMaterialTexture(0, driver->getTexture(s)); return 0; } */