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.

185 lines
3.9 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 _WIN32
  16. #pragma once
  17. #endif
  18. #include <mxtk/mxMatSysWindow.h>
  19. #include "materialsystem/imaterialsystem.h"
  20. #include "interface.h"
  21. class ITexture;
  22. class MatSysWindow : public mxMatSysWindow
  23. {
  24. public:
  25. // CREATORS
  26. MatSysWindow( mxWindow *parent, int x, int y, int w, int h, const char *label, int style );
  27. ~MatSysWindow( );
  28. // MANIPULATORS
  29. void dumpViewport (const char *filename);
  30. void dumpViewportWithLabel (const char *filename, const char *label);
  31. virtual int handleEvent( mxEvent *event );
  32. virtual void draw( );
  33. Color getViewportPixelColor( int x, int y );
  34. void *m_hWnd;
  35. // void *m_hDC;
  36. CSysModule *m_hMaterialSystemInst;
  37. ITexture *m_pCubemapTexture;
  38. };
  39. extern MatSysWindow *g_MatSysWindow;
  40. extern IMaterial *g_materialBackground;
  41. extern IMaterial *g_materialWireframe;
  42. extern IMaterial *g_materialWireframeVertexColor;
  43. extern IMaterial *g_materialWireframeVertexColorNoCull;
  44. extern IMaterial *g_materialDebugCopyBaseTexture;
  45. extern IMaterial *g_materialFlatshaded;
  46. extern IMaterial *g_materialSmoothshaded;
  47. extern IMaterial *g_materialBones;
  48. extern IMaterial *g_materialLines;
  49. extern IMaterial *g_materialFloor;
  50. extern IMaterial *g_materialVertexColor;
  51. extern IMaterial *g_materialShadow;
  52. extern IMaterial *g_materialArcActive;
  53. extern IMaterial *g_materialArcInActive;
  54. extern IMaterial *g_materialDebugText;
  55. #if 0
  56. typedef struct
  57. {
  58. int width;
  59. int height;
  60. int bpp;
  61. int flags;
  62. int frequency;
  63. } screen_res_t;
  64. typedef struct
  65. {
  66. int width;
  67. int height;
  68. int bpp;
  69. } devinfo_t;
  70. class MaterialSystemApp
  71. {
  72. public:
  73. MaterialSystemApp();
  74. ~MaterialSystemApp();
  75. void Term();
  76. // Post a message to shutdown the app.
  77. void AppShutdown();
  78. int WinMain(void *hInstance, void *hPrevInstance, char *szCmdLine, int iCmdShow);
  79. long WndProc(void *hwnd, long iMsg, long wParam, long lParam);
  80. int FindNumParameter(const char *s, int defaultVal=-1);
  81. bool FindParameter(const char *s);
  82. const char* FindParameterArg(const char *s);
  83. void SetTitleText(const char *fmt, ...);
  84. private:
  85. bool InitMaterialSystem();
  86. void Clear();
  87. bool CreateMainWindow(int width, int height, int bpp, bool fullscreen);
  88. void RenderScene();
  89. void MouseCapture();
  90. void MouseRelease();
  91. void GetParameters();
  92. public:
  93. IMaterialSystem *m_pMaterialSystem;
  94. void *m_hMaterialSystemInst;
  95. devinfo_t m_DevInfo;
  96. void *m_hInstance;
  97. int m_iCmdShow;
  98. void *m_hWnd;
  99. void *m_hDC;
  100. bool m_bActive;
  101. bool m_bFullScreen;
  102. int m_width;
  103. int m_height;
  104. int m_centerx; // for mouse offset calculations
  105. int m_centery;
  106. int m_bpp;
  107. BOOL m_bChangeBPP;
  108. BOOL m_bAllowSoft;
  109. BOOL m_bPaused;
  110. int m_glnWidth;
  111. int m_glnHeight;
  112. float m_gldAspect;
  113. float m_NearClip;
  114. float m_FarClip;
  115. float m_fov;
  116. screen_res_t *m_pResolutions;
  117. int m_iResCount;
  118. int m_iVidMode;
  119. };
  120. // ---------------------------------------------------------------------------------------- //
  121. // Global functions
  122. // ---------------------------------------------------------------------------------------- //
  123. // Show an error dialog and quit.
  124. bool Sys_Error(const char *pMsg, ...);
  125. // Print to the trace window.
  126. void con_Printf(const char *pMsg, ...);
  127. // Returns true if the key is down.
  128. bool IsKeyDown(char key);
  129. extern MaterialSystemApp g_MaterialSystemApp;
  130. extern unsigned int g_Time;
  131. #endif
  132. #endif // GLAPP_H