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.

179 lines
3.7 KiB

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