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.

100 lines
3.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef GAMEUISYSTEMSURFACE_H
  8. #define GAMEUISYSTEMSURFACE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "igameuisystemmgr.h"
  13. #include "materialsystem/imaterialsystem.h"
  14. #include "vgui_surfacelib/ifontsurface.h"
  15. #include "tier1/utldict.h"
  16. #include "rendersystem/irenderdevice.h"
  17. class CFontTextureCache;
  18. class KeyValues;
  19. //-----------------------------------------------------------------------------
  20. // This class is the interface to the font and font texture, systems.
  21. // Load fonts given by schemes into the systems using this class.
  22. //-----------------------------------------------------------------------------
  23. class CGameUISystemSurface : public IGameUISystemSurface
  24. {
  25. public:
  26. CGameUISystemSurface();
  27. ~CGameUISystemSurface();
  28. InitReturnVal_t Init();
  29. void Shutdown();
  30. void PrecacheFontCharacters( FontHandle_t font, wchar_t *pCharacterString = NULL );
  31. FontHandle_t CreateFont();
  32. bool SetFontGlyphSet( FontHandle_t font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags, int nRangeMin = 0, int nRangeMax = 0 );
  33. int GetFontTall( FontHandle_t font );
  34. void GetCharABCwide( FontHandle_t font, int ch, int &a, int &b, int &c );
  35. int GetCharacterWidth( FontHandle_t font, int ch );
  36. const char *GetFontName( FontHandle_t font );
  37. bool AddCustomFontFile( const char *fontFileName );
  38. // Helper fxns for loading bitmap fonts
  39. bool AddBitmapFontFile( const char *fontFileName );
  40. void SetBitmapFontName( const char *pName, const char *pFontFilename );
  41. const char *GetBitmapFontName( const char *pName );
  42. bool SetBitmapFontGlyphSet( FontHandle_t font, const char *windowsFontName, float scalex, float scaley, int flags);
  43. void ClearTemporaryFontCache( void );
  44. // Causes fonts to get reloaded, etc.
  45. void ResetFontCaches();
  46. bool SupportsFontFeature( FontFeature_t feature );
  47. void DrawSetTextureRGBA( int id, const unsigned char* rgba, int wide, int tall ){}
  48. void DrawSetTextureRGBAEx( int id, const unsigned char* rgba, int wide, int tall, ImageFormat format ){}
  49. bool GetUnicodeCharRenderPositions( FontCharRenderInfo& info, Vector2D *pPositions );
  50. IMaterial *GetTextureForChar( FontCharRenderInfo &info, float **texCoords );
  51. IMaterial *GetTextureAndCoordsForChar( FontCharRenderInfo &info, float *texCoords );
  52. // Used for debugging.
  53. void DrawFontTexture( int textureId, int xPos, int yPos );
  54. void DrawFontTexture( IRenderContext *pRenderContext, int textureId, int xPos, int yPos );
  55. IMaterial *GetMaterial( int textureId );
  56. HRenderTexture GetTextureHandle( int textureId );
  57. void GetProportionalBase( int &width, int &height ) { width = BASE_WIDTH; height = BASE_HEIGHT; }
  58. void SetLanguage( const char *pLanguage );
  59. const char *GetLanguage();
  60. private:
  61. enum { BASE_HEIGHT = 480, BASE_WIDTH = 640 };
  62. bool m_bIsInitialized;
  63. CUtlVector< CUtlSymbol > m_CustomFontFileNames;
  64. CUtlVector< CUtlSymbol > m_BitmapFontFileNames;
  65. CUtlDict< int, int > m_BitmapFontFileMapping;
  66. };
  67. extern CGameUISystemSurface *g_pGameUISystemSurface;
  68. #endif // GAMEUISYSTEMSURFACE_H