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>
6 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef R2_INSTANCE_MAP_DECO_H
22 #define R2_INSTANCE_MAP_DECO_H
25 #include "../interface_v3/group_map.h"
26 #include "displayer_visual.h"
41 /** Tool to display of an instance in current scenario in the world map (a world map DECO
42 * This class derives from CGroupMap::IDeco, meaning it must be added / removed to the world map
43 * by calling CGroupMap::addDeco / CGroupMap::removeDeco
46 class CInstanceMapDeco
: public CGroupMap::IDeco
51 // Set the instance displayed by this map decoration
52 void setDisplayedInstance(CInstance
*instance
, bool orientable
);
53 bool isAddedToMap() const { return _AddedToMap
; }
55 NLMISC::CVector2f
getWorldPos() const;
57 /** Set the texture to use when the view in the world map is zoomed-in enough
58 * When empty, no close view display is done
60 void setCloseTexture(const std::string
&texture
) { _CloseTexture
= texture
; }
62 virtual void onAdd(CGroupMap
&owner
);
64 virtual void onRemove(CGroupMap
&owner
);
66 virtual void onUpdate(CGroupMap
&owner
);
68 virtual void onPreRender(CGroupMap
&owner
);
70 void setTextureAndFit(const std::string
&bitmapName
);
72 void invalidateCoords();
75 void setActive(bool active
);
76 bool getActive() { return _Active
; }
78 // Set invalid pos flag
79 void setInvalidPosFlag(bool invalid
);
82 /** special derived class from CBitmap that allows to know what is the current instance when
83 * the mouse position is tested against the map (see R2::CTool::checkInstanceUnderMouse for details)
85 class CCtrlButtonEntity
: public CCtrlButton
, public IDisplayerUIHandle
88 CCtrlButtonEntity(CInstance
&instance
) : CCtrlButton(TCtorParam()), _Instance(instance
) {}
89 // from IDisplayerUIHandle
90 virtual CInstance
&getDisplayedInstance() { return _Instance
; }
91 virtual bool handleEvent (const NLGUI::CEventDescriptor
&event
);
95 virtual void getContextHelp(std::string
&help
) const;
96 bool emptyContextHelp() const { return true; }
97 bool wantInstantContextHelp() const { return true; }
98 virtual bool isCapturable() const { return false; }
101 CInstance
*_Instance
;
102 CCtrlButtonEntity
*_Main
;
104 CCtrlQuad
*_OverInvalid
;
105 CCtrlQuad
*_GlowStar
[2];
107 CVector _GlowStarPos
;
108 std::string _CloseTexture
;
109 float _OrientBlendFactor
;
110 bool _GlowStarActive
: 1;
111 bool _LastCloseView
: 1;
112 bool _AddedToMap
: 1;
114 bool _Orientable
: 1;
115 bool _InvalidPos
: 1;
118 CCtrlQuad
*newQuad(CGroupMap
&owner
);