afxGuiText.cpp

Engine/source/afx/ce/afxGuiText.cpp

More...

Public Defines

define
myOffset(field) (field, )

Public Functions

ConsoleDocClass(afxGuiTextData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Gui Text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Gui Text effect, with the help of an existing afxGuiTextHud, can be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> display 2D text effects on the Gui Canvas. " " Essentially, using Gui Text effects with an <a href="/coding/class/classafxguitexthud/">afxGuiTextHud</a> is like using the stock GuiShapeNameHud, but with the ability " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make additional text elements come and go as effects constrained <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the projection of 3D positions onto the 2D screen." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

Detailed Description

Public Defines

myOffset(field) (field, )

Public Functions

ConsoleDocClass(afxGuiTextData , "@brief A datablock that specifies <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Gui Text <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">effect.\n\n</a>" "A Gui Text effect, with the help of an existing afxGuiTextHud, can be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> display 2D text effects on the Gui Canvas. " " Essentially, using Gui Text effects with an <a href="/coding/class/classafxguitexthud/">afxGuiTextHud</a> is like using the stock GuiShapeNameHud, but with the ability " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> make additional text elements come and go as effects constrained <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the projection of 3D positions onto the 2D screen." "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">afxEffects\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">AFX\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

IMPLEMENT_CO_DATABLOCK_V1(afxGuiTextData )

  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#include "afx/arcaneFX.h"
 28
 29#include "core/stream/bitStream.h"
 30
 31#include "afx/ce/afxGuiText.h"
 32
 33//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 34// afxGuiTextData
 35
 36IMPLEMENT_CO_DATABLOCK_V1(afxGuiTextData);
 37
 38ConsoleDocClass( afxGuiTextData,
 39   "@brief A datablock that specifies a Gui Text effect.\n\n"
 40
 41   "A Gui Text effect, with the help of an existing afxGuiTextHud, can be used to display 2D text effects on the Gui Canvas. "
 42   "Essentially, using Gui Text effects with an afxGuiTextHud is like using the stock GuiShapeNameHud, but with the ability "
 43   "to make additional text elements come and go as effects constrained to the projection of 3D positions onto the 2D screen."
 44   "\n\n"
 45
 46   "@ingroup afxEffects\n"
 47   "@ingroup AFX\n"
 48   "@ingroup Datablocks\n"
 49);
 50
 51afxGuiTextData::afxGuiTextData()
 52{
 53  text_str = ST_NULLSTRING;
 54  text_clr.set(1,1,1,1);
 55}
 56
 57afxGuiTextData::afxGuiTextData(const afxGuiTextData& other, bool temp_clone) : GameBaseData(other, temp_clone)
 58{
 59  text_str = other.text_str;
 60  text_clr = other.text_clr;
 61}
 62
 63#define myOffset(field) Offset(field, afxGuiTextData)
 64
 65void afxGuiTextData::initPersistFields()
 66{
 67  addField("text",    TypeString,     myOffset(text_str),
 68    "The literal text to display on the afxGuiTextHud. The center of the text will be "
 69    "placed at the projection of the 3D constraint position into 2D screen space.\n"
 70    "If the text field is set to the special string, '#shapeName', the shape name of the "
 71    "primary position constraint object will be used. (This is only meaningful if the "
 72    "constraint source is a ShapeBase-derived object.)");
 73  addField("color",   TypeColorF,     myOffset(text_clr),
 74    "A color value for the text label.");
 75
 76  Parent::initPersistFields();
 77}
 78
 79bool afxGuiTextData::onAdd()
 80{
 81  if (Parent::onAdd() == false)
 82    return false;
 83
 84  return true;
 85}
 86
 87void afxGuiTextData::packData(BitStream* stream)
 88{
 89   Parent::packData(stream);
 90
 91  stream->writeString(text_str);
 92  stream->write(text_clr);
 93}
 94
 95void afxGuiTextData::unpackData(BitStream* stream)
 96{
 97  Parent::unpackData(stream);
 98
 99  text_str = stream->readSTString();
100  stream->read(&text_clr);
101}
102
103
104//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
105