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.

109 lines
3.8 KiB

  1. //========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef IVIDEOMODE_H
  10. #define IVIDEOMODE_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "vmodes.h"
  15. #include "vtf/vtf.h"
  16. struct MovieInfo_t;
  17. //-----------------------------------------------------------------------------
  18. // Purpose:
  19. //-----------------------------------------------------------------------------
  20. abstract_class IVideoMode
  21. {
  22. public:
  23. virtual ~IVideoMode() {}
  24. virtual bool Init( ) = 0;
  25. virtual void Shutdown( void ) = 0;
  26. // Shows the start-up graphics based on the mod
  27. // (Filesystem path for the mod must be set up first)
  28. virtual void DrawStartupGraphic() = 0;
  29. // Creates the game window, plays the startup movie, starts up the material system
  30. virtual bool CreateGameWindow( int nWidth, int nHeight, bool bWindowed, bool bNoWindowBorder ) = 0;
  31. // Sets the game window in editor mode
  32. virtual void SetGameWindow( void *hWnd ) = 0;
  33. // Sets the video mode, and re-sizes the window
  34. virtual bool SetMode( int nWidth, int nHeight, bool bWindowed, bool bNoWindowBorder ) = 0;
  35. // Returns the fullscreen modes for the adapter the game was started on
  36. virtual int GetModeCount( void ) = 0;
  37. virtual struct vmode_s *GetMode( int num ) = 0;
  38. // Purpose: This is called in response to a WM_MOVE message
  39. // or whatever the equivalent that would be under linux
  40. virtual void UpdateWindowPosition( void ) = 0;
  41. // Alt-tab handling
  42. virtual void RestoreVideo( void ) = 0;
  43. virtual void ReleaseVideo( void ) = 0;
  44. virtual void DrawNullBackground( void *hdc, int w, int h ) = 0;
  45. virtual void InvalidateWindow() = 0;
  46. // Returns the video mode width + height. In the case of windowed mode,
  47. // it returns the width and height of the drawable region of the window.
  48. // (it doesn't include the window borders)
  49. virtual int GetModeWidth() const = 0;
  50. virtual int GetModeHeight() const = 0;
  51. virtual bool IsWindowedMode() const = 0;
  52. virtual bool NoWindowBorder() const = 0;
  53. // Returns the subrect to draw the client view into.
  54. // Coordinates are measured relative to the drawable region of the window
  55. virtual const vrect_t & GetClientViewRect( ) const = 0;
  56. virtual void SetClientViewRect( const vrect_t &viewRect ) = 0;
  57. // Lazily recomputes client view rect
  58. virtual void MarkClientViewRectDirty() = 0;
  59. virtual void TakeSnapshotTGA( const char *pFileName ) = 0;
  60. virtual void TakeSnapshotTGARect( const char *pFilename, int x, int y, int w, int h, int resampleWidth, int resampleHeight, bool bPFM = false, CubeMapFaceIndex_t faceIndex = CUBEMAP_FACE_RIGHT ) = 0;
  61. virtual void WriteMovieFrame( const MovieInfo_t& info ) = 0;
  62. // Takes snapshots
  63. virtual void TakeSnapshotJPEG( const char *pFileName, int quality ) = 0;
  64. virtual bool TakeSnapshotJPEGToBuffer( CUtlBuffer& buf, int quality ) = 0;
  65. };
  66. //-----------------------------------------------------------------------------
  67. // Utilities for virtual screen coordinates
  68. //-----------------------------------------------------------------------------
  69. #define XRES(x) ( x * ( ( float )videomode->GetModeWidth() / 640.0 ) )
  70. #define YRES(y) ( y * ( ( float )videomode->GetModeHeight() / 480.0 ) )
  71. //-----------------------------------------------------------------------------
  72. // Singleton accessor
  73. //-----------------------------------------------------------------------------
  74. #if !defined( DEDICATED )
  75. extern IVideoMode *videomode;
  76. #endif
  77. //-----------------------------------------------------------------------------
  78. // Class factory
  79. //-----------------------------------------------------------------------------
  80. void VideoMode_Create();
  81. void VideoMode_Destroy();
  82. #endif // IVIDEOMODE_H