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.

90 lines
3.6 KiB

  1. //====== Copyright � 1996-2010, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: interface the game must provide Steam with on PS3 in order for the
  4. // Steam overlay to render.
  5. //
  6. //=============================================================================
  7. #ifndef ISTEAMPS3OVERLAYRENDERER_H
  8. #define ISTEAMPS3OVERLAYRENDERER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "cell/pad.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Enum for supported gradient directions
  15. //-----------------------------------------------------------------------------
  16. enum EOverlayGradientDirection
  17. {
  18. k_EOverlayGradientHorizontal = 1,
  19. k_EOverlayGradientVertical = 2,
  20. k_EOverlayGradientNone = 3,
  21. };
  22. // Helpers for fetching individual color components from ARGB packed DWORD colors Steam PS3 overlay renderer uses.
  23. #define STEAM_COLOR_RED( color ) \
  24. (int)(((color)>>16)&0xff)
  25. #define STEAM_COLOR_GREEN( color ) \
  26. (int)(((color)>>8)&0xff)
  27. #define STEAM_COLOR_BLUE( color ) \
  28. (int)((color)&0xff)
  29. #define STEAM_COLOR_ALPHA( color ) \
  30. (int)(((color)>>24)&0xff)
  31. //-----------------------------------------------------------------------------
  32. // Purpose: Interface the game must expose to Steam for rendering
  33. //-----------------------------------------------------------------------------
  34. class ISteamPS3OverlayRenderHost
  35. {
  36. public:
  37. // Interface for game engine to implement which Steam requires to render.
  38. // Draw a textured rect. This may use only part of the texture and will pass texture coords, it will also possibly request a gradient and will specify colors for vertexes.
  39. virtual void DrawTexturedRect( int x0, int y0, int x1, int y1, float u0, float v0, float u1, float v1, int32 iTextureID, DWORD colorStart, DWORD colorEnd, EOverlayGradientDirection eDirection ) = 0;
  40. // Load a RGBA texture for Steam, or update a previously loaded one. Updates may be partial. You must not evict or remove this texture once Steam has uploaded it.
  41. virtual void LoadOrUpdateTexture( int32 iTextureID, bool bIsFullTexture, int x0, int y0, uint32 uWidth, uint32 uHeight, int32 iBytes, char *pData ) = 0;
  42. // Delete a texture Steam previously uploaded
  43. virtual void DeleteTexture( int32 iTextureID ) = 0;
  44. // Delete all previously uploaded textures
  45. virtual void DeleteAllTextures() = 0;
  46. };
  47. //-----------------------------------------------------------------------------
  48. // Purpose: Interface Steam exposes for the game to tell it when to render, etc.
  49. //-----------------------------------------------------------------------------
  50. class ISteamPS3OverlayRender
  51. {
  52. public:
  53. // Call once at startup to initialize the Steam overlay and pass it your host interface ptr
  54. virtual bool BHostInitialize( uint32 unScreenWidth, uint32 unScreenHeight, uint32 unRefreshRate, ISteamPS3OverlayRenderHost *pRenderHost, void *CellFontLib ) = 0;
  55. // Call this once a frame when you are ready for the Steam overlay to render (ie, right before flipping buffers, after all your rendering)
  56. virtual void Render() = 0;
  57. // Call this everytime you read input on PS3.
  58. //
  59. // If this returns true, then the overlay is active and has consumed the input, your game
  60. // should then ignore all the input until BHandleCellPadData once again returns false, which
  61. // will mean the overlay is deactivated.
  62. virtual bool BHandleCellPadData( const CellPadData &padData ) = 0;
  63. // Call this if you detect no controllers connected or that the XMB is intercepting input
  64. //
  65. // This is important to clear input state for the overlay, so keys left down during XMB activation
  66. // are not continued to be processed.
  67. virtual bool BResetInputState() = 0;
  68. };
  69. #endif // ISTEAMPS3OVERLAYRENDERER_H