afxGuiTextHud.h
Engine/source/afx/ui/afxGuiTextHud.h
Classes:
class
Displays name & damage above shape objects.
Detailed Description
1 2 3//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 4// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames 5// Copyright (C) 2015 Faust Logic, Inc. 6// 7// Permission is hereby granted, free of charge, to any person obtaining a copy 8// of this software and associated documentation files (the "Software"), to 9// deal in the Software without restriction, including without limitation the 10// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 11// sell copies of the Software, and to permit persons to whom the Software is 12// furnished to do so, subject to the following conditions: 13// 14// The above copyright notice and this permission notice shall be included in 15// all copies or substantial portions of the Software. 16// 17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23// IN THE SOFTWARE. 24// 25//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 26 27#ifndef _AFX_GUI_TEXT_HUD_H_ 28#define _AFX_GUI_TEXT_HUD_H_ 29 30#include "gui/core/guiControl.h" 31 32//---------------------------------------------------------------------------- 33/// Displays name & damage above shape objects. 34/// 35/// This control displays the name and damage value of all named 36/// ShapeBase objects on the client. The name and damage of objects 37/// within the control's display area are overlayed above the object. 38/// 39/// This GUI control must be a child of a TSControl, and a server connection 40/// and control object must be present. 41/// 42/// This is a stand-alone control and relies only on the standard base GuiControl. 43class afxGuiTextHud : public GuiControl 44{ 45 typedef GuiControl Parent; 46 47 struct HudTextSpec 48 { 49 Point3F pos; 50 const char* text; 51 LinearColorF text_clr; 52 SceneObject* obj; 53 }; 54 55 static Vector<HudTextSpec> text_items; 56 57 // field data 58 LinearColorF mFillColor; 59 LinearColorF mFrameColor; 60 LinearColorF mTextColor; 61 62 F32 mVerticalOffset; 63 F32 mDistanceFade; 64 bool mShowFrame; 65 bool mShowFill; 66 bool mLabelAllShapes; 67 bool mEnableControlObjectOcclusion; 68 69protected: 70 void drawName( Point2I offset, const char *buf, F32 opacity, LinearColorF* color=0); 71 72public: 73 afxGuiTextHud(); 74 75 // GuiControl 76 virtual void onRender(Point2I offset, const RectI &updateRect); 77 78 static void initPersistFields(); 79 static void addTextItem(const Point3F& pos, const char* text, LinearColorF& color, SceneObject* obj=0); 80 static void reset(); 81 82 DECLARE_CONOBJECT( afxGuiTextHud ); 83 DECLARE_CATEGORY("AFX"); 84}; 85 86//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// 87 88#endif //_AFX_GUI_TEXT_HUD_H_ 89