Fix issue in Rocket.lua script.
[Cafu-Engine.git] / Libs / GuiSys / CompTransform.cpp
blob95a77fbadbd1c5a9dd35170dd31ab231fc2e28b7
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
7 #include "CompTransform.hpp"
8 #include "AllComponents.hpp"
10 extern "C"
12 #include <lua.h>
13 #include <lualib.h>
14 #include <lauxlib.h>
17 using namespace cf::GuiSys;
20 const char* ComponentTransformT::DocClass =
21 "This component adds information about the position and size of the window.";
24 const cf::TypeSys::VarsDocT ComponentTransformT::DocVars[] =
26 { "Pos", "The position of the top-left corner of the window, relative to its parent." },
27 { "Size", "The size of the window." },
28 { "Rotation", "The angle in degrees by how much this entire window is rotated." },
29 { NULL, NULL }
33 ComponentTransformT::ComponentTransformT()
34 : ComponentBaseT(),
35 m_Pos("Pos", Vector2fT(0.0f, 0.0f)),
36 m_Size("Size", Vector2fT(80.0f, 60.0f)),
37 m_RotAngle("Rotation", 0.0f)
39 GetMemberVars().Add(&m_Pos);
40 GetMemberVars().Add(&m_Size);
41 GetMemberVars().Add(&m_RotAngle);
45 ComponentTransformT::ComponentTransformT(const ComponentTransformT& Comp)
46 : ComponentBaseT(Comp),
47 m_Pos(Comp.m_Pos),
48 m_Size(Comp.m_Size),
49 m_RotAngle(Comp.m_RotAngle)
51 GetMemberVars().Add(&m_Pos);
52 GetMemberVars().Add(&m_Size);
53 GetMemberVars().Add(&m_RotAngle);
57 ComponentTransformT* ComponentTransformT::Clone() const
59 return new ComponentTransformT(*this);
63 static const cf::TypeSys::MethsDocT META_toString =
65 "__tostring",
66 "This method returns a readable string representation of this object.",
67 "string", "()"
70 int ComponentTransformT::toString(lua_State* LuaState)
72 // ScriptBinderT Binder(LuaState);
73 // IntrusivePtrT<ComponentBaseT> Comp = Binder.GetCheckedObjectParam< IntrusivePtrT<ComponentBaseT> >(1);
75 lua_pushfstring(LuaState, "transform component");
76 return 1;
80 /***********************************/
81 /*** TypeSys-related definitions ***/
82 /***********************************/
84 void* ComponentTransformT::CreateInstance(const cf::TypeSys::CreateParamsT& Params)
86 return new ComponentTransformT();
89 const luaL_Reg ComponentTransformT::MethodsList[] =
91 { "__tostring", toString },
92 { NULL, NULL }
95 const cf::TypeSys::MethsDocT ComponentTransformT::DocMethods[] =
97 META_toString,
98 { NULL, NULL, NULL, NULL }
101 const cf::TypeSys::TypeInfoT ComponentTransformT::TypeInfo(GetComponentTIM(), "GuiSys::ComponentTransformT", "GuiSys::ComponentBaseT", ComponentTransformT::CreateInstance, MethodsList, DocClass, DocMethods, NULL, DocVars);