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.

138 lines
3.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #if !defined( __SCALEFORMUIINTEGRATION_H__ )
  8. #define __SCALEFORMUIINTEGRATION_H__
  9. /****************************
  10. * This is the wrapper around the valve memory manager
  11. */
  12. class CScaleformSysAlloc: public SF::SysAlloc
  13. {
  14. public:
  15. virtual void* Alloc( SF::UPInt size, SF::UPInt align );
  16. virtual void Free( void* ptr, SF::UPInt size, SF::UPInt align );
  17. virtual void* Realloc( void* oldPtr, SF::UPInt oldSize, SF::UPInt newSize, SF::UPInt align );
  18. };
  19. /*****************************************************
  20. * This redirects the scaleform logging calls to CSTrike
  21. */
  22. class ScaleformUILogging: public SF::Log
  23. {
  24. public:
  25. virtual void LogMessageVarg( SF::LogMessageId messageId, const char* pfmt, va_list argList );
  26. };
  27. /******************************************************
  28. * gives scaleform access tot he clipboard
  29. */
  30. class ScaleformClipboard: public SF::GFx::TextClipboard
  31. {
  32. public:
  33. virtual void OnTextStore( const wchar_t* ptext, SF::UPInt len );
  34. };
  35. /************************
  36. * wraps the scaleform translation functions
  37. */
  38. class ScaleformTranslatorAdapter: public SF::GFx::Translator
  39. {
  40. public:
  41. virtual unsigned GetCaps( void ) const;
  42. virtual void Translate( TranslateInfo* tinfo );
  43. };
  44. /********************
  45. * used by CreateAPI. It attaches the movieview to the GFxValue of the api
  46. */
  47. class ScaleformMovieUserData: public SF::GFx::ASUserData
  48. {
  49. public:
  50. // this is a weak link
  51. SF::GFx::Movie* m_pMovie;
  52. virtual void OnDestroy( SF::GFx::Movie* pmovie, void* pobject );
  53. };
  54. /*****************************
  55. * serves as a thunk between the scaleform code and the game code
  56. */
  57. class ScaleformFunctionHandlerAdapter: public SF::GFx::FunctionHandler
  58. {
  59. public:
  60. virtual void Call( const Params& params );
  61. };
  62. /********************************
  63. * this lets scaleform use the valve file location stuff
  64. */
  65. class ScaleformFileOpener : public SF::GFx::FileOpenerBase
  66. {
  67. public:
  68. // Override to opens a file using user-defined function and/or GFile class.
  69. // The default implementation uses buffer-wrapped GSysFile, but only
  70. // if GFC_USE_SYSFILE is defined.
  71. // The 'purl' should be encoded as UTF-8 to support international file names.
  72. virtual SF::File* OpenFile(const char* purl,
  73. int flags = SF::FileConstants::Open_Read|SF::FileConstants::Open_Buffered,
  74. int mode = SF::FileConstants::Mode_ReadWrite);
  75. // Returns last modified date/time required for file change detection.
  76. // Can be implemented to return 0 if no change detection is desired.
  77. // Default implementation checks file time if GFC_USE_SYSFILE is defined.
  78. // The 'purl' should be encoded as UTF-8 to support international file names.
  79. virtual SF::SInt64 GetFileModifyTime(const char* purl);
  80. // Open file with customizable log, by relying on OpenFile.
  81. // If not null, log will receive error messages on failure.
  82. // The 'purl' should be encoded as UTF-8 to support international file names.
  83. virtual SF::File* OpenFileEx(const char* purl, SF::GFx::Log *plog,
  84. int flags = SF::FileConstants::Open_Read|SF::FileConstants::Open_Buffered,
  85. int mode = SF::FileConstants::Mode_ReadWrite);
  86. };
  87. /********************************
  88. * this lets scaleform use our gamer icons and any other dynamic textures
  89. */
  90. class CScaleformImageCreator : public SF::GFx::ImageCreator
  91. {
  92. public:
  93. CScaleformImageCreator( IScaleformUI *pSFUI, SF::GFx::TextureManager* textureManager = 0);
  94. // Looks up image for "img://" protocol.
  95. virtual SF::GFx::Image* LoadProtocolImage(const SF::GFx::ImageCreateInfo& info, const SF::String& url);
  96. private:
  97. IScaleformUI* m_pScaleformUI;
  98. };
  99. #endif