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.

214 lines
4.5 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //===========================================================================//
  13. #ifndef MATSYSWIN_H
  14. #define MATSYSWIN_H
  15. #ifdef COMPILER_MSVC
  16. #pragma once
  17. #endif
  18. #include <mxtk/mxMatSysWindow.h>
  19. #include "materialsystem/imaterialsystem.h"
  20. #include "faceposertoolwindow.h"
  21. #include "interface.h"
  22. #include "tier2/tier2.h"
  23. class MatSysWindow : public mxMatSysWindow, public IFacePoserToolWindow
  24. {
  25. typedef mxMatSysWindow BaseClass;
  26. public:
  27. // CREATORS
  28. MatSysWindow( mxWindow *parent, int x, int y, int w, int h, const char *label, int style );
  29. ~MatSysWindow( );
  30. // MANIPULATORS
  31. virtual int handleEvent( mxEvent *event );
  32. virtual void draw( );
  33. virtual void redraw();
  34. void EnableStickySnapshotMode( void );
  35. void DisableStickySnapshotMode( void );
  36. void PushSnapshotMode( int nSnapShotSize );
  37. void PopSnapshotMode( void );
  38. void TakeSnapshotRect( const char *pFilename, int x, int y, int w, int h );
  39. bool IsSuppressingResize( void );
  40. void SuppressResize( bool suppress );
  41. void TakeScreenShot(const char *filename);
  42. void Frame( void );
  43. void DrawFrame( void );
  44. void SuppressBufferSwap( bool bSuppress );
  45. void *m_hWnd;
  46. private:
  47. bool m_bSuppressResize;
  48. bool m_bSuppressSwap;
  49. // stack and sticky window mode
  50. int m_stickyDepth;
  51. bool m_bIsSticky;
  52. int m_snapshotDepth;
  53. WINDOWPLACEMENT m_wp;
  54. HCURSOR m_hPrevCursor;
  55. };
  56. extern MatSysWindow *g_pMatSysWindow;
  57. extern IMaterial *g_materialBackground;
  58. extern IMaterial *g_materialWireframe;
  59. extern IMaterial *g_materialWireframe;
  60. extern IMaterial *g_materialWireframeVertexColor;
  61. extern IMaterial *g_materialWireframeVertexColorNoCull;
  62. extern IMaterial *g_materialDebugCopyBaseTexture;
  63. extern IMaterial *g_materialFlatshaded;
  64. extern IMaterial *g_materialSmoothshaded;
  65. extern IMaterial *g_materialBones;
  66. extern IMaterial *g_materialLines;
  67. extern IMaterial *g_materialFloor;
  68. extern IMaterial *g_materialArcActive;
  69. extern IMaterial *g_materialArcInActive;
  70. extern IMaterial *g_materialDebugText;
  71. #if 0
  72. typedef struct
  73. {
  74. int width;
  75. int height;
  76. int bpp;
  77. int flags;
  78. int frequency;
  79. } screen_res_t;
  80. typedef struct
  81. {
  82. int width;
  83. int height;
  84. int bpp;
  85. } devinfo_t;
  86. class MaterialSystemApp
  87. {
  88. public:
  89. MaterialSystemApp();
  90. ~MaterialSystemApp();
  91. void Term();
  92. // Post a message to shutdown the app.
  93. void AppShutdown();
  94. int WinMain(void *hInstance, void *hPrevInstance, char *szCmdLine, int iCmdShow);
  95. long WndProc(void *hwnd, long iMsg, long wParam, long lParam);
  96. int FindNumParameter(const char *s, int defaultVal=-1);
  97. bool FindParameter(const char *s);
  98. const char* FindParameterArg(const char *s);
  99. void SetTitleText(const char *fmt, ...);
  100. private:
  101. bool InitMaterialSystem();
  102. void Clear();
  103. bool CreateMainWindow(int width, int height, int bpp, bool fullscreen);
  104. void RenderScene();
  105. void MouseCapture();
  106. void MouseRelease();
  107. void GetParameters();
  108. public:
  109. IMaterialSystem *m_pMaterialSystem;
  110. void *m_hMaterialSystemInst;
  111. devinfo_t m_DevInfo;
  112. void *m_hInstance;
  113. int m_iCmdShow;
  114. void *m_hWnd;
  115. void *m_hDC;
  116. bool m_bActive;
  117. bool m_bFullScreen;
  118. int m_width;
  119. int m_height;
  120. int m_centerx; // for mouse offset calculations
  121. int m_centery;
  122. int m_bpp;
  123. BOOL m_bChangeBPP;
  124. BOOL m_bAllowSoft;
  125. BOOL m_bPaused;
  126. int m_glnWidth;
  127. int m_glnHeight;
  128. float m_gldAspect;
  129. float m_NearClip;
  130. float m_FarClip;
  131. float m_fov;
  132. screen_res_t *m_pResolutions;
  133. int m_iResCount;
  134. int m_iVidMode;
  135. };
  136. // ---------------------------------------------------------------------------------------- //
  137. // Global functions
  138. // ---------------------------------------------------------------------------------------- //
  139. // Show an error dialog and quit.
  140. bool Sys_Error(const char *pMsg, ...);
  141. // Print to the trace window.
  142. void con_Printf(const char *pMsg, ...);
  143. // Returns true if the key is down.
  144. bool IsKeyDown(char key);
  145. extern MaterialSystemApp g_MaterialSystemApp;
  146. #ifdef __cplusplus
  147. extern "C" {
  148. #endif
  149. extern unsigned int g_Time;
  150. #ifdef __cplusplus
  151. };
  152. #endif
  153. #endif
  154. #endif // GLAPP_H