Fix codestyle since CSM Camera API

This commit is contained in:
Loic Blot 2017-05-06 21:30:27 +02:00
parent 07c17db114
commit a024042bf5
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
2 changed files with 42 additions and 48 deletions

@ -12,7 +12,7 @@ LuaCamera::LuaCamera(Camera *m)
void LuaCamera::create(lua_State *L, Camera *m) void LuaCamera::create(lua_State *L, Camera *m)
{ {
LuaCamera *o = new LuaCamera(m); LuaCamera *o = new LuaCamera(m);
*(void **) (lua_newuserdata(L, sizeof(void *))) = o; *(void **)(lua_newuserdata(L, sizeof(void *))) = o;
luaL_getmetatable(L, className); luaL_getmetatable(L, className);
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
@ -140,7 +140,7 @@ LuaCamera *LuaCamera::checkobject(lua_State *L, int narg)
if (!ud) if (!ud)
luaL_typerror(L, narg, className); luaL_typerror(L, narg, className);
return *(LuaCamera **) ud; return *(LuaCamera **)ud;
} }
Camera *LuaCamera::getobject(LuaCamera *ref) Camera *LuaCamera::getobject(LuaCamera *ref)
@ -160,7 +160,7 @@ Camera *LuaCamera::getobject(lua_State *L, int narg)
int LuaCamera::gc_object(lua_State *L) int LuaCamera::gc_object(lua_State *L)
{ {
LuaCamera *o = *(LuaCamera **) (lua_touserdata(L, 1)); LuaCamera *o = *(LuaCamera **)(lua_touserdata(L, 1));
delete o; delete o;
return 0; return 0;
} }
@ -191,16 +191,12 @@ void LuaCamera::Register(lua_State *L)
} }
const char LuaCamera::className[] = "Camera"; const char LuaCamera::className[] = "Camera";
const luaL_reg LuaCamera::methods[] = { const luaL_reg LuaCamera::methods[] = {luamethod(LuaCamera, set_camera_mode),
luamethod(LuaCamera, set_camera_mode), luamethod(LuaCamera, get_camera_mode), luamethod(LuaCamera, get_fov),
luamethod(LuaCamera, get_camera_mode), luamethod(LuaCamera, get_pos), luamethod(LuaCamera, get_offset),
luamethod(LuaCamera, get_fov),
luamethod(LuaCamera, get_pos),
luamethod(LuaCamera, get_offset),
luamethod(LuaCamera, get_look_dir), luamethod(LuaCamera, get_look_dir),
luamethod(LuaCamera, get_look_vertical), luamethod(LuaCamera, get_look_vertical),
luamethod(LuaCamera, get_look_horizontal), luamethod(LuaCamera, get_look_horizontal),
luamethod(LuaCamera, get_aspect_ratio), luamethod(LuaCamera, get_aspect_ratio),
{0, 0} {0, 0}};
};

@ -5,9 +5,9 @@
class Camera; class Camera;
class LuaCamera : public ModApiBase { class LuaCamera : public ModApiBase
{
private: private:
static const char className[]; static const char className[];
static const luaL_Reg methods[]; static const luaL_Reg methods[];
@ -29,7 +29,6 @@ private:
Camera *m_camera; Camera *m_camera;
public: public:
LuaCamera(Camera *m); LuaCamera(Camera *m);
~LuaCamera() {} ~LuaCamera() {}
@ -40,7 +39,6 @@ public:
static Camera *getobject(lua_State *L, int narg); static Camera *getobject(lua_State *L, int narg);
static void Register(lua_State *L); static void Register(lua_State *L);
}; };
#endif // L_CAMERA_H #endif // L_CAMERA_H