home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Game Programming for Teens / VBGPFT.cdr / DirectX8 / dx8a_sdk.exe / samples / multimedia / direct3d / mfctex / mfctex.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-04  |  4.5 KB  |  156 lines

  1. //-----------------------------------------------------------------------------
  2. // File: MFCTex.h
  3. //
  4. // Desc: Header file for a D3DIM app that uses MFC
  5. //
  6. //
  7. // Copyright (c) 1997-2000 Microsoft Corporation. All rights reserved.
  8. //-----------------------------------------------------------------------------
  9. #ifndef D3D_MFC_APP_H
  10. #define D3D_MFC_APP_H
  11.  
  12. #if _MSC_VER >= 1000
  13. #pragma once
  14. #endif
  15. #ifndef __AFXWIN_H__
  16. #error include 'stdafx.h' before including this file
  17. #endif
  18.  
  19. #include "resource.h"
  20.  
  21.  
  22.  
  23.  
  24. //-----------------------------------------------------------------------------
  25. // Name: class CAppDoc
  26. // Desc: Overridden CDocument class needed for the CFormView
  27. //-----------------------------------------------------------------------------
  28. class CAppDoc : public CDocument
  29. {
  30. protected:
  31.     DECLARE_DYNCREATE(CAppDoc)
  32. };
  33.  
  34.  
  35.  
  36.  
  37. //-----------------------------------------------------------------------------
  38. // Name: class CAppFrameWnd
  39. // Desc: CFrameWnd-based class needed to override the CFormView's window style
  40. //-----------------------------------------------------------------------------
  41. class CAppFrameWnd : public CFrameWnd
  42. {
  43. protected:
  44.     DECLARE_DYNCREATE(CAppFrameWnd)
  45. public:
  46.     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
  47. };
  48.  
  49.  
  50.  
  51.  
  52. //-----------------------------------------------------------------------------
  53. // Name: class CApp
  54. // Desc: Main MFCapplication class derived from CWinApp.
  55. //-----------------------------------------------------------------------------
  56. class CApp : public CWinApp
  57. {
  58. public:
  59.     //{{AFX_VIRTUAL(CD3DApp)
  60.     virtual BOOL InitInstance();
  61.     virtual BOOL OnIdle( LONG );
  62.     //}}AFX_VIRTUAL
  63.  
  64.     //{{AFX_MSG(CApp)
  65.     //}}AFX_MSG
  66.     DECLARE_MESSAGE_MAP()
  67. };
  68.  
  69.  
  70.  
  71.  
  72. //-----------------------------------------------------------------------------
  73. // Name: class CAppForm
  74. // Desc: CFormView-based class which allows the UI to be created with a form
  75. //       (dialog) resource. This class manages all the controls on the form.
  76. //-----------------------------------------------------------------------------
  77. class CAppForm : public CFormView, public CD3DApplication
  78. {
  79. private:
  80.     CD3DFont*  m_pFont;              // Font for drawing text
  81.     HWND       m_hwndRenderWindow;
  82.     HWND       m_hwndRenderFullScreen;
  83.  
  84.     TCHAR      m_strFileName[MAX_PATH];
  85.     TCHAR      m_strInitialDir[MAX_PATH];
  86.  
  87.     CComboBox *m_pTex0ColorArg1, *m_pTex0ColorOp, *m_pTex0ColorArg2;
  88.     CComboBox *m_pTex0AlphaArg1, *m_pTex0AlphaOp, *m_pTex0AlphaArg2;
  89.     CComboBox *m_pTex1ColorArg1, *m_pTex1ColorOp, *m_pTex1ColorArg2;
  90.     CComboBox *m_pTex1AlphaArg1, *m_pTex1AlphaOp, *m_pTex1AlphaArg2;
  91.     CComboBox *m_pTex2ColorArg1, *m_pTex2ColorOp, *m_pTex2ColorArg2;
  92.     CComboBox *m_pTex2AlphaArg1, *m_pTex2AlphaOp, *m_pTex2AlphaArg2;
  93.  
  94.     PDIRECT3DVERTEXBUFFER8 m_pVBWalls;
  95.     PDIRECT3DVERTEXBUFFER8 m_pVBFloorCeiling;
  96.  
  97.     HRESULT ConfirmDevice( D3DCAPS8*,DWORD,D3DFORMAT );
  98.     HRESULT OneTimeSceneInit();
  99.     HRESULT InitDeviceObjects();
  100.     HRESULT RestoreDeviceObjects();
  101.     HRESULT FrameMove();
  102.     HRESULT Render();
  103.     HRESULT InvalidateDeviceObjects();
  104.     HRESULT DeleteDeviceObjects();
  105.     HRESULT FinalCleanup();
  106.     virtual HRESULT AdjustWindowForChange();
  107.  
  108.     VOID    UpdateUIForDeviceCapabilites();
  109.     VOID    InitializeUIControls();
  110.     VOID    UpdateStageColor( WORD stage, LONG op, LONG arg1, LONG arg2 );
  111.     VOID    UpdateStageAlpha( WORD stage, LONG op, LONG arg1, LONG arg2 );
  112.     VOID    SetTextureMaps( const TCHAR*, const TCHAR*, const TCHAR* );
  113.  
  114. public:
  115.     BOOL IsReady() { return m_bReady; }
  116.     TCHAR* PstrFrameStats() { return m_strFrameStats; }
  117.     VOID RenderScene() { Render3DEnvironment(); }
  118.     HRESULT CheckForLostFullscreen();
  119.  
  120. protected:
  121.     DECLARE_DYNCREATE(CAppForm)
  122.  
  123.              CAppForm();
  124.     virtual  ~CAppForm();
  125. public:
  126.     //{{AFX_DATA(CAppForm)
  127.     enum { IDD = IDD_FORMVIEW };
  128.     //}}AFX_DATA
  129.  
  130.     //{{AFX_VIRTUAL(CAppForm)
  131.     virtual void OnInitialUpdate();
  132.     //}}AFX_VIRTUAL
  133.  
  134.     //{{AFX_MSG(CAppForm)
  135.     afx_msg VOID OnToggleFullScreen();
  136.     afx_msg VOID OnViewCode();
  137.     afx_msg VOID OnChangeDevice();
  138.     afx_msg VOID OnChangePresetEffects();
  139.     afx_msg VOID OnChangeTex();
  140.     afx_msg VOID OnSelectTexture0Name();
  141.     afx_msg VOID OnSelectTexture1Name();
  142.     afx_msg VOID OnSelectTexture2Name();
  143.     afx_msg VOID OnChangeBlendFactor();
  144.     afx_msg VOID OnChangeDiffuseColor();
  145.     afx_msg VOID OnChangeStageArgs();
  146.     //}}AFX_MSG
  147.     DECLARE_MESSAGE_MAP()
  148. };
  149.  
  150.  
  151.  
  152.  
  153. #endif
  154.  
  155.  
  156.