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.
7 #include "CompTransform.hpp"
8 #include "AllComponents.hpp"
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." },
33 ComponentTransformT::ComponentTransformT()
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
),
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
=
66 "This method returns a readable string representation of this object.",
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");
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
},
95 const cf::TypeSys::MethsDocT
ComponentTransformT::DocMethods
[] =
98 { NULL
, NULL
, NULL
, NULL
}
101 const cf::TypeSys::TypeInfoT
ComponentTransformT::TypeInfo(GetComponentTIM(), "GuiSys::ComponentTransformT", "GuiSys::ComponentBaseT", ComponentTransformT::CreateInstance
, MethodsList
, DocClass
, DocMethods
, NULL
, DocVars
);