1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef CL_GROUP_IN_SCENE_HELP_H
24 #define CL_GROUP_IN_SCENE_HELP_H
26 #include "nel/misc/types_nl.h"
27 #include "nel/gui/group_container.h"
28 #include "nel/gui/group_menu.h"
32 * Group Displayed "InScene", with a 3d Position
33 * NB: it does require that you change the Position each frame, but you don't have to call
34 * invalidateCoords() each frame
35 * \author Cyril 'Hulud' Corvazier
36 * \author Nevrax France
39 class CGroupInScene
: public CInterfaceGroup
42 DECLARE_UI_CLASS(CGroupInScene
)
44 CGroupInScene(const TCtorParam
¶m
);
47 // From CInterfaceElement
48 virtual void updateCoords();
50 virtual bool parse (xmlNodePtr cur
, CInterfaceGroup
*parent
);
51 // Called each frame to just move X/Y positions.
52 virtual void onFrameUpdateWindowPos (sint dx
, sint dy
);
54 // Position of the group in world space
55 NLMISC::CVector Position
;
56 // useful only if getUserScale()==true
59 void setUserScale(bool us
);
60 bool getUserScale() const {return _UserScale
;}
62 REFLECT_EXPORT_START(CGroupInScene
, CInterfaceGroup
)
63 REFLECT_SINT32("offset_x", getOffsetX
, setOffsetX
);
64 REFLECT_SINT32("offset_y", getOffsetY
, setOffsetY
);
67 sint32
getOffsetX() const { return _OffsetX
; }
68 void setOffsetX(sint32 dmh
) { _OffsetX
= dmh
; }
69 sint32
getOffsetY() const { return _OffsetY
; }
70 void setOffsetY(sint32 dmh
) { _OffsetY
= dmh
; }
72 // set/return the ZBias for this group in scene (default 0)
73 void setZBias(float zbias
) {_ZBias
= zbias
;}
74 float getZBias() const {return _ZBias
;}
76 virtual void serial(NLMISC::IStream
&f
);
80 // Projected Position memorized. x/y is in window coordinate, while z in is world/camera coordinate
81 NLMISC::CVector _ProjCenter
;
84 sint32 _OffsetX
, _OffsetY
;
86 // scale the group according to user setup
92 void computeWindowPos(sint32
&newX
, sint32
&newY
, NLMISC::CVector
&newProjCenter
);
94 static const float NearDrawClip
;
98 #endif // CL_GROUP_IN_SCENE_HELP_H