Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef GAMETEXT_H
  8. #define GAMETEXT_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "vgui_surfacelib/ifontsurface.h"
  13. #include "vgui/ilocalize.h"
  14. #include "gamegraphic.h"
  15. #include "dmxloader/dmxelement.h"
  16. #include "animdata.h"
  17. #include "gameuisystemmgr.h"
  18. //-----------------------------------------------------------------------------
  19. //
  20. //-----------------------------------------------------------------------------
  21. class CGameText : public CGameGraphic
  22. {
  23. DECLARE_DMXELEMENT_UNPACK()
  24. public:
  25. CGameText( const char *pName );
  26. virtual ~CGameText();
  27. bool Unserialize( CDmxElement *pGraphic );
  28. virtual KeyValues * HandleScriptCommand( KeyValues *args );
  29. void SetFont( const char *pFontName );
  30. void SetText( const char *text );
  31. // where text should go relative to center position.
  32. enum Justification_e
  33. {
  34. JUSTIFICATION_LEFT,
  35. JUSTIFICATION_CENTER,
  36. JUSTIFICATION_RIGHT,
  37. };
  38. void SetJustification( Justification_e justify );
  39. void GetTextSize( int &wide, int &tall );
  40. // from CGameGraphic
  41. virtual void UpdateGeometry();
  42. virtual void UpdateRenderData( color32 parentColor, CUtlVector< RenderGeometryList_t > &renderGeometryLists, int firstListIndex );
  43. virtual void DrawExtents( CUtlVector< RenderGeometryList_t > &renderGeometryLists, int firstListIndex );
  44. virtual void SetColor( color32 c );
  45. virtual bool HitTest( int x, int y );
  46. private:
  47. CGameText();
  48. void SetText( const wchar_t *unicode, bool bClearUnlocalizedSymbol = false );
  49. void GetStartingTextPosition( int &x, int &y );
  50. CRenderGeometry *GetGeometryEntry( CUtlVector< RenderGeometryList_t > &renderGeometryLists, int firstListIndex, int fontTextureID );
  51. void SetupVertexColors();
  52. int GetTextRenderWidth();
  53. int GetTextRenderHeight();
  54. void SetFont( FontHandle_t font );
  55. FontHandle_t GetFont();
  56. void GetRenderInfo( CUtlVector< FontCharRenderInfo > &renderInfoList );
  57. wchar_t *m_UnicodeText; // unicode version of the text
  58. short m_TextBufferLen; // size of the text buffer
  59. CUtlString m_CharText; // unlocalized version of the text
  60. vgui::StringIndex_t m_UnlocalizedTextSymbol;
  61. CUtlString m_FontName;
  62. FontHandle_t m_Font;
  63. bool m_bAllCaps;
  64. int m_Justification;
  65. };
  66. #endif // GAMETEXT_H