Team Fortress 2 Source Code as on 22/4/2020
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.

108 lines
3.1 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef UITOPLEVELWINDOWOPENVROVERLAY_H
  6. #define UITOPLEVELWINDOWOPENVROVERLAY_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include <openvr.h>
  11. namespace panorama
  12. {
  13. class CTopLevelWindowOverlay;
  14. class CTopLevelWindowOpenVROverlay : public CTopLevelWindow
  15. {
  16. typedef CTopLevelWindow BaseClass;
  17. public:
  18. CTopLevelWindowOpenVROverlay( CUIEngine *pUIEngineParent );
  19. virtual ~CTopLevelWindowOpenVROverlay();
  20. // Initialize backing surface for window
  21. virtual bool BInitializeSurface( int nWidth, int nHeight, vr::VROverlayHandle_t ulOverlayHandle );
  22. // Run any per window frame func logic
  23. virtual void RunPlatformFrame();
  24. // Resize the window to specified dimensions
  25. virtual void OnWindowResize( uint32 nWidth, uint32 nHeight );
  26. // Window position management
  27. virtual void SetWindowPosition( float x, float y );
  28. virtual void GetWindowPosition( float &x, float &y );
  29. virtual void GetWindowBounds( float &left, float &top, float &right, float &bottom );
  30. virtual void GetClientDimensions( float &width, float &height );
  31. virtual void Activate( bool bForceful );
  32. virtual bool BHasFocus() { return m_bFocus; }
  33. virtual bool BIsFullscreen() { return m_bFullScreen; }
  34. virtual void* GetNativeWindowHandle() { return 0; }
  35. virtual bool BAllowInput( InputMessage_t &msg );
  36. virtual bool BIsVisible() { return m_bVisible; }
  37. virtual void SetVisible( bool bVisible ) { AssertMsg( false, "SetVisible not implemented on CTopLevelWindowOverlay" ); }
  38. void SetInputEnabled( bool bEnabled ) { m_bInputEnabled = bEnabled; }
  39. // Clear color for the window, normally black, transparent for overlay
  40. virtual Color GetClearColor() { return Color( 0, 0, 0, 0 ); }
  41. // Necessary for generating mouse enter & leave events on windows
  42. bool IsMouseOver() { return m_bMouseOverWindow; }
  43. void OnMouseEnter();
  44. void OnMouseLeave() { m_bMouseOverWindow = false; }
  45. void SetMouseCursor( EMouseCursors eCursor );
  46. bool SetGameProcessInfo( AppId_t nAppId, bool bCanSharedSurfaces, int32 eTextureFormat );
  47. void ProcessInputEvents();
  48. bool BVisiblityChanged() const { return m_bVisibleThisFrame != m_bVisibleLastFrame; }
  49. void PushOverlayRenderCmdStream( CSharedMemStream *pRenderStream, unsigned long dwPID, float flOpacity, EOverlayWindowAlignment alignment );
  50. void SetGameWindowSize( uint32 nWidth, uint32 nHeight );
  51. void SetFixedSurfaceSize( uint32 unSurfaceWidth, uint32 unSurfaceHeight );
  52. void OnMouseMove( float x, float y );
  53. void SetFocus( bool bFocus );
  54. #ifdef DBGFLAG_VALIDATE
  55. virtual void Validate( CValidator &validator, const tchar *pchName );
  56. #endif
  57. protected:
  58. virtual void Shutdown();
  59. private:
  60. IUI3DSurface *m_p3DSurface;
  61. bool m_bMouseOverWindow;
  62. bool m_bInputEnabled;
  63. bool m_bFocus;
  64. bool m_bCanShareSurfaces;
  65. bool m_bVisibleThisFrame;
  66. bool m_bVisibleLastFrame;
  67. uint32 m_unGameWidth;
  68. uint32 m_unGameHeight;
  69. bool m_bFullScreen;
  70. bool m_bVisible;
  71. vr::VROverlayHandle_t m_ulOverlayHandle;
  72. };
  73. } // namespace panorama
  74. #endif // UITOPLEVELWINDOWOPENVROVERLAY_H