Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CMiniMap Class Reference

#include <CMiniMap.h>

Inheritance diagram for CMiniMap:
Collaboration diagram for CMiniMap:

Classes

struct  MapFlare
 

Public Member Functions

 CMiniMap (CGUI &pGUI)
 
virtual ~CMiniMap ()
 
bool Flare (const CVector2D &pos, const CStr &colorStr)
 
- Public Member Functions inherited from IGUIObject
 NONCOPYABLE (IGUIObject)
 
 IGUIObject (CGUI &pGUI)
 
virtual ~IGUIObject ()
 
virtual bool IsMouseOver () const
 This function checks if the mouse is hovering the rectangle that the base setting "size" makes. More...
 
virtual bool IsMouseHovering () const
 This function returns true if the mouse is hovering over this GUI object and if this GUI object is the topmost object in that screen location. More...
 
const CStr & GetName () const
 Get object name, name is unique. More...
 
void SetName (const CStr &Name)
 Get object name. More...
 
CStr GetPresentableName () const
 
const std::vector< IGUIObject * > & GetChildren () const
 Return all child objects of the current object. More...
 
void RegisterSetting (const CStr &Name, IGUISetting *setting)
 Registers the given setting with the GUI object. More...
 
void ReregisterSetting (const CStr &Name, IGUISetting *setting)
 
bool SettingExists (const CStr &Setting) const
 Returns whether there is a setting with the given name registered. More...
 
bool SetSettingFromString (const CStr &Setting, const CStrW &Value, const bool SendMessage)
 Set a setting by string, regardless of what type it is. More...
 
bool IsEnabled () const
 Returns whether this object is set to be hidden or ghost. More...
 
bool IsHidden () const
 Returns whether this is object is set to be hidden. More...
 
void SetHidden (bool hidden)
 
bool IsHiddenOrGhost () const
 Returns whether this object is set to be hidden or ghost. More...
 
void PlaySound (const CStrW &soundPath) const
 Retrieves the configured sound filename from the given setting name and plays that once. More...
 
InReaction SendEvent (EGUIMessageType type, const CStr &eventName)
 Send event to this GUI object (HandleMessage and ScriptEvent) More...
 
InReaction SendMouseEvent (EGUIMessageType type, const CStr &eventName)
 Same as SendEvent, but passes mouse coordinates and button state as an argument. More...
 
virtual void UpdateCachedSize ()
 All sizes are relative to resolution, and the calculation is not wanted in real time, therefore it is cached, update the cached size with this function. More...
 
CRect GetComputedSize ()
 Updates and returns the size of the object. More...
 
virtual const CStrW & GetTooltipText () const
 
virtual const CStr & GetTooltipStyle () const
 
virtual void ResetStates ()
 Reset internal state of this object. More...
 
void RegisterScriptHandler (const CStr &eventName, const CStr &Code, CGUI &pGUI)
 Set the script handler for a particular object-specific action. More...
 
JSObject * GetJSObject ()
 Retrieves the JSObject representing this GUI object. More...
 
virtual void Tick ()
 Called on every GUI tick unless the object or one of its parent is hidden/ghost. More...
 
template<typename... Args>
void RecurseObject (bool(IGUIObject::*isRestricted)() const, void(IGUIObject::*callbackFunction)(Args... args), Args &&... args)
 Calls an IGUIObject member function recursively on this object and its children. More...
 
CGUIGetGUI ()
 
const CGUIGetGUI () const
 
void SetFocus ()
 Take focus! More...
 
void ReleaseFocus ()
 Release focus. More...
 

Protected Member Functions

virtual void Draw (CCanvas2D &canvas)
 Draws the object. More...
 
virtual void CreateJSObject ()
 Creates the JS object representing this page upon first use. More...
 
virtual void HandleMessage (SGUIMessage &Message)
 
virtual bool IsMouseOver () const
 
- Protected Member Functions inherited from IGUIObject
virtual InReaction PreemptEvent (const SDL_Event_ *ev)
 Some objects need to be able to pre-emptively process SDL_Event_. More...
 
virtual InReaction ManuallyHandleKeys (const SDL_Event_ *ev)
 Some objects need to handle the text-related SDL_Event_ manually. More...
 
bool ApplyStyle (const CStr &StyleName)
 Applies the given style to the object. More...
 
virtual float GetBufferedZ () const
 Returns not the Z value, but the actual buffered Z value, i.e. More...
 
void RegisterChild (IGUIObject *child)
 Add an object to the hierarchy. More...
 
void UnregisterChild (IGUIObject *child)
 Remove an object from the hierarchy. More...
 
void SetParent (IGUIObject *pParent)
 Set parent of this object. More...
 
bool IsFocused () const
 Check if object is focused. More...
 
IGUIObjectGetParent () const
 NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return nullptr, so that the top-node's children are seemingly parentless. More...
 
virtual bool HandleAdditionalChildren (const XMBData &file, const XMBElement &child)
 Handle additional children to the <object>-tag. More...
 
virtual void AdditionalChildrenHandled ()
 Allow the GUI object to process after all child items were handled. More...
 
void ScriptEvent (const CStr &eventName)
 Execute the script for a particular action. More...
 
bool ScriptEventWithReturn (const CStr &eventName)
 Execute the script for a particular action. More...
 
void ScriptEvent (const CStr &eventName, const JS::HandleValueArray &paramData)
 Execute the script for a particular action. More...
 
bool ScriptEventWithReturn (const CStr &eventName, const JS::HandleValueArray &paramData)
 Execute the script for a particular action. More...
 
void SetScriptHandler (const CStr &eventName, JS::HandleObject Function)
 Assigns a JS function to the event name. More...
 
void UnsetScriptHandler (const CStr &eventName)
 Deletes an event handler assigned to the given name, if such a handler exists. More...
 
void UpdateMouseOver (IGUIObject *const &pMouseOver)
 Inputes the object that is currently hovered, this function updates this object accordingly (i.e. More...
 

Private Member Functions

void SetCameraPositionFromMousePosition ()
 
bool FireWorldClickEvent (int button, int clicks)
 
void RecreateFlareTextures ()
 
void DrawViewRect (CCanvas2D &canvas) const
 
void DrawFlare (CCanvas2D &canvas, const MapFlare &flare, double currentTime) const
 
void DrawFlareFrame (CCanvas2D &canvas, const u32 frameIndex, const CRect &destination, const CColor &color, float alpha) const
 
void GetMouseWorldCoordinates (float &x, float &z) const
 
float GetAngle () const
 
CVector2D WorldSpaceToMiniMapSpace (const CVector3D &worldPosition) const
 

Private Attributes

bool m_Clicking
 
std::deque< MapFlarem_MapFlares
 
std::vector< CTexturePtrm_FlareTextures
 
CGUISimpleSetting< u32m_FlareTextureCount
 
CGUISimpleSetting< u32m_FlareRenderSize
 
CGUISimpleSetting< bool > m_FlareInterleave
 
CGUISimpleSetting< float > m_FlareAnimationSpeed
 
CGUISimpleSetting< float > m_FlareLifetimeSeconds
 
CGUISimpleSetting< float > m_FlareStartFadeSeconds
 
CGUISimpleSetting< float > m_FlareStopFadeSeconds
 
CGUISimpleSetting< bool > m_Mask
 
ssize_t m_MapSize
 
float m_MapScale
 

Static Private Attributes

static const CStr EventNameWorldClick = "WorldClick"
 

Additional Inherited Members

- Protected Attributes inherited from IGUIObject
CRect m_CachedActualSize
 Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time. More...
 
CStr m_Name
 
std::vector< IGUIObject * > m_Children
 
IGUIObjectm_pParent
 
double m_LastClickTime [6]
 
bool m_MouseHovering
 This variable is true if the mouse is hovering this object and this object is the topmost object shown in this location. More...
 
std::map< CStr, IGUISetting * > m_Settings
 Settings pool, all an object's settings are located here. More...
 
CGUIm_pGUI
 
std::map< CStr, JS::Heap< JSObject * > > m_ScriptHandlers
 
std::unique_ptr< IGUIProxyObjectm_JSObject
 
CGUISimpleSetting< bool > m_Enabled
 
CGUISimpleSetting< bool > m_Hidden
 
CGUISimpleSetting< CGUISizem_Size
 
CGUISimpleSetting< CStr > m_Style
 
CGUIHotkey m_Hotkey
 
CGUISimpleSetting< float > m_Z
 
CGUISimpleSetting< bool > m_Absolute
 
CGUISimpleSetting< bool > m_Ghost
 
CGUISimpleSetting< float > m_AspectRatio
 
CGUISimpleSetting< CStrW > m_Tooltip
 
CGUISimpleSetting< CStr > m_TooltipStyle
 
- Static Protected Attributes inherited from IGUIObject
static const CStr EventNameMouseEnter = "MouseEnter"
 
static const CStr EventNameMouseMove = "MouseMove"
 
static const CStr EventNameMouseLeave = "MouseLeave"
 

Constructor & Destructor Documentation

◆ CMiniMap()

CMiniMap::CMiniMap ( CGUI pGUI)

◆ ~CMiniMap()

CMiniMap::~CMiniMap ( )
virtualdefault

Member Function Documentation

◆ CreateJSObject()

virtual void CMiniMap::CreateJSObject ( )
protectedvirtual

Creates the JS object representing this page upon first use.

This function (and its derived versions) are defined in the GUIProxy implementation file for convenience.

Reimplemented from IGUIObject.

◆ Draw()

void CMiniMap::Draw ( CCanvas2D canvas)
protectedvirtual

Draws the object.

Implements IGUIObject.

◆ DrawFlare()

void CMiniMap::DrawFlare ( CCanvas2D canvas,
const MapFlare flare,
double  currentTime 
) const
private

◆ DrawFlareFrame()

void CMiniMap::DrawFlareFrame ( CCanvas2D canvas,
const u32  frameIndex,
const CRect destination,
const CColor color,
float  alpha 
) const
private

◆ DrawViewRect()

void CMiniMap::DrawViewRect ( CCanvas2D canvas) const
private

◆ FireWorldClickEvent()

bool CMiniMap::FireWorldClickEvent ( int  button,
int  clicks 
)
private

◆ Flare()

bool CMiniMap::Flare ( const CVector2D pos,
const CStr &  colorStr 
)

◆ GetAngle()

float CMiniMap::GetAngle ( ) const
private

◆ GetMouseWorldCoordinates()

void CMiniMap::GetMouseWorldCoordinates ( float &  x,
float &  z 
) const
private

◆ HandleMessage()

void CMiniMap::HandleMessage ( SGUIMessage Message)
protectedvirtual
See also
IGUIObject::HandleMessage()

Reimplemented from IGUIObject.

◆ IsMouseOver()

bool CMiniMap::IsMouseOver ( ) const
protectedvirtual
See also
IGUIObject::IsMouseOver()

Reimplemented from IGUIObject.

◆ RecreateFlareTextures()

void CMiniMap::RecreateFlareTextures ( )
private

◆ SetCameraPositionFromMousePosition()

void CMiniMap::SetCameraPositionFromMousePosition ( )
private

◆ WorldSpaceToMiniMapSpace()

CVector2D CMiniMap::WorldSpaceToMiniMapSpace ( const CVector3D worldPosition) const
private

Member Data Documentation

◆ EventNameWorldClick

const CStr CMiniMap::EventNameWorldClick = "WorldClick"
staticprivate

◆ m_Clicking

bool CMiniMap::m_Clicking
private

◆ m_FlareAnimationSpeed

CGUISimpleSetting<float> CMiniMap::m_FlareAnimationSpeed
private

◆ m_FlareInterleave

CGUISimpleSetting<bool> CMiniMap::m_FlareInterleave
private

◆ m_FlareLifetimeSeconds

CGUISimpleSetting<float> CMiniMap::m_FlareLifetimeSeconds
private

◆ m_FlareRenderSize

CGUISimpleSetting<u32> CMiniMap::m_FlareRenderSize
private

◆ m_FlareStartFadeSeconds

CGUISimpleSetting<float> CMiniMap::m_FlareStartFadeSeconds
private

◆ m_FlareStopFadeSeconds

CGUISimpleSetting<float> CMiniMap::m_FlareStopFadeSeconds
private

◆ m_FlareTextureCount

CGUISimpleSetting<u32> CMiniMap::m_FlareTextureCount
private

◆ m_FlareTextures

std::vector<CTexturePtr> CMiniMap::m_FlareTextures
private

◆ m_MapFlares

std::deque<MapFlare> CMiniMap::m_MapFlares
private

◆ m_MapScale

float CMiniMap::m_MapScale
private

◆ m_MapSize

ssize_t CMiniMap::m_MapSize
private

◆ m_Mask

CGUISimpleSetting<bool> CMiniMap::m_Mask
private

The documentation for this class was generated from the following files: