DirectXApp.h
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. // Copyright (C) 1998-1999 DXGuide.  All Rights Reserved.
  2. // File: DirectXApp.h
  3. #ifndef _DIRECTXAPP__H
  4. #define _DIRECTXAPP__H
  5. #if _MSC_VER >= 1000
  6. #pragma once
  7. #endif // _MSC_VER >= 1000
  8. #include "DirectDraw.h"
  9. #include "DirectInput.h"
  10. #include "DirectSound.h"
  11. #include "DirectMusic.h"
  12. class CD3DViewport;
  13. class CDDSurface;
  14. class CPackFileManager;
  15. class CDXGUIManager;
  16. class CDirectXApp : public CWinApp
  17. {
  18. friend class CDirectXFrame;
  19. #ifdef _LOG_HTML
  20. friend class CDirectX;
  21. #endif // _LOG_HTML
  22. public:
  23. // Flags for DDInit
  24. enum DXAppInitFlag
  25. {
  26. DXAPPIF_DD = 0x00000001L,
  27. DXAPPIF_D3DIM = 0x00000002L,
  28. DXAPPIF_DI = 0x00000010L, // Use DirectInput
  29. DXAPPIF_DS = 0x00000100L, // Use DirectSound
  30. DXAPPIF_DMUS = 0x00001000L, // Use DirectMusic
  31. DXAPPIF_GUIMANAGER = 0x00010000L, // Use DXGUIManager
  32. DXAPPIF_NO_SWITCH = 0x00100000L, // Switch display mode ?
  33. DXAPPIF_HIGHPRIORITY = 0x00200000L, // Set Priority ?
  34. DXAPPIF_SHOWSTATDLG = 0x00400000L, // Show Statistic Dialog ?
  35. };
  36. public:
  37. CDirectXApp(void);
  38. virtual ~CDirectXApp();
  39. public:
  40. virtual bool GetDXInitSettings(void);
  41. virtual bool InitDXObjects(void) = 0;
  42. virtual bool DestroyDXObjects(void);
  43. virtual bool UpdateFrame(void);
  44. virtual void OnActive(bool  bActivate);
  45. protected:
  46. bool m_bReinitialize;
  47. public:
  48. bool SwitchDisplayMode(void);
  49. bool Reset(void);
  50. public:
  51. bool IsFullScreen(void) const;
  52. void SetFullScreen(bool  bFullScreen);
  53. CDDDevice* GetFirstDDDevice(void) const;
  54. CD3DDevice* GetFirstD3DDevice(void) const;
  55. protected:
  56. virtual LPCTSTR GetClassName(void) const;
  57. virtual bool IsFirstInstance(void);
  58. public:
  59. void SetPackFileName(LPCTSTR  lpszPackFileName,
  60. LPCTSTR  lpszGUIPackFileName);
  61. protected:
  62. virtual double CalcFPS(DWORD&  dwTimeSpan);
  63. protected:
  64. DWORD m_dwAppInitFlags;
  65. DWORD m_dwDDInitFlags;
  66. DWORD m_dwDSInitFlags;
  67. DWORD m_dwDIInitFlags;
  68. DWORD m_dwGUIManagerInitFlags;
  69. bool m_bActive;
  70. CDirectDraw* m_pDirectDraw;
  71. CDirectInput* m_pDirectInput;
  72. CDirectSound* m_pDirectSound;
  73. CDirectMusic* m_pDirectMusic;
  74. CDXGUIManager* m_pGUIManager;
  75. DWORD m_dwFrames;
  76. DWORD m_dwTimeStart;
  77. CString m_strPackFileName;
  78. CString m_strGUIPackFileName;
  79. CPackFileManager* m_pPackFileManager;
  80. protected:
  81. LPCTSTR m_lpcszUniqueClass;
  82. bool m_bClassRegistered;
  83. // Overrides
  84. // ClassWizard generated virtual function overrides
  85. //{{AFX_VIRTUAL(CDirectXApp)
  86. public:
  87. virtual BOOL InitInstance();
  88. virtual BOOL OnIdle(LONG lCount);
  89. virtual int ExitInstance();
  90. //}}AFX_VIRTUAL
  91. // Implementation
  92. //{{AFX_MSG(CDirectXApp)
  93. afx_msg void OnAppAbout();
  94. // NOTE - the ClassWizard will add and remove member functions here.
  95. //    DO NOT EDIT what you see in these blocks of generated code !
  96. //}}AFX_MSG
  97. DECLARE_MESSAGE_MAP()
  98. };
  99. #include "DirectXApp.inl"
  100. #endif // _DIRECTXAPP__H