0001: //-----------------------------------------------------------------------------
0002: // File: CheckDeviceFormatViewer.h
0003: //
0004: // Desc: Header file CheckDeviceFormatViewer sample app
0005: //-----------------------------------------------------------------------------
0006: #pragma once
0007: #ifndef __AFXWIN_H__
0008: #error include 'stdafx.h' before including this file
0009: #endif
0010: 
0011: 
0012: 
0013: 
0014: //-----------------------------------------------------------------------------
0015: // Defines, and constants
0016: //-----------------------------------------------------------------------------
0017: // TODO: change "DirectX AppWizard Apps" to your name or the company name
0018: #define DXAPP_KEY        TEXT("Software\\DirectX AppWizard Apps\\CheckDeviceFormatViewer")
0019: 
0020: // Struct to store the current input state
0021: struct UserInput
0022: {
0023:     // TODO: change as needed
0024:     BOOL bRotateUp;
0025:     BOOL bRotateDown;
0026:     BOOL bRotateLeft;
0027:     BOOL bRotateRight;
0028: };
0029: 
0030: // フォーマット管理
0031: typedef struct {
0032:     D3DFORMAT   val;
0033:     char        text[64];
0034: }MyFormat;
0035: 
0036: // Usage 管理
0037: typedef struct {
0038:     DWORD       val;
0039:     char        text[64];
0040: }MyUsage;
0041: 
0042: 
0043: 
0044: //-----------------------------------------------------------------------------
0045: // Name: class CAppForm
0046: // Desc: CFormView-based class which allows the UI to be created with a form
0047: //       (dialog) resource. This class manages all the controls on the form.
0048: //-----------------------------------------------------------------------------
0049: class CAppForm : public CFormView, public CD3DApplication
0050: {
0051: public:
0052:     BOOL                    m_bLoadingApp;          // TRUE, if the app is loading
0053:     ID3DXFont*              m_pFont;                // D3DX font    
0054:     UserInput               m_UserInput;            // Struct for storing user input 
0055: 
0056:     FLOAT                   m_fWorldRotX;           // World rotation state X-axis
0057:     FLOAT                   m_fWorldRotY;           // World rotation state Y-axis
0058: 
0059:     static const MyFormat   *m_Formats;
0060:     int                     m_nFormat;
0061:     static const MyUsage    *m_Usages;
0062: 
0063:     BOOL                    *m_pbResult;
0064: 
0065: private:
0066:     HWND    m_hwndRenderWindow;
0067:     HWND    m_hwndRenderFullScreen;
0068:     HWND    m_hWndTopLevelParent;
0069: 
0070:     virtual HRESULT ConfirmDevice( D3DCAPS9*,DWORD,D3DFORMAT );
0071:     virtual HRESULT OneTimeSceneInit();
0072:     virtual HRESULT InitDeviceObjects();
0073:     virtual HRESULT RestoreDeviceObjects();
0074:     virtual HRESULT FrameMove();
0075:     virtual HRESULT Render();
0076:     virtual HRESULT InvalidateDeviceObjects();
0077:     virtual HRESULT DeleteDeviceObjects();
0078:     virtual HRESULT FinalCleanup();
0079:     virtual HRESULT AdjustWindowForChange();
0080: 
0081:     HRESULT RenderText();
0082: 
0083:     void    UpdateInput( UserInput* pUserInput );
0084:     VOID    ReadSettings();
0085:     VOID    WriteSettings();
0086: 
0087:     VOID    UpdateUIForDeviceCapabilites();
0088: 
0089: protected:
0090:     DECLARE_DYNCREATE(CAppForm)
0091: 
0092:              CAppForm();
0093:     virtual  ~CAppForm();
0094: 
0095: public:
0096:     BOOL IsReady() { return m_bActive; }
0097:     TCHAR* PstrFrameStats() { return m_strFrameStats; }
0098:     VOID RenderScene() { Render3DEnvironment(); }
0099:     HRESULT CheckForLostFullscreen();
0100: 
0101:     //{{AFX_DATA(CAppForm)
0102:     enum { IDD = IDD_FORMVIEW };
0103:     //}}AFX_DATA
0104: 
0105:     //{{AFX_VIRTUAL(CAppForm)
0106:     virtual void OnInitialUpdate();
0107:     protected:
0108:     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
0109:     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
0110:     //}}AFX_VIRTUAL
0111: 
0112: public:
0113:     //{{AFX_MSG(CAppForm)
0114:     afx_msg void OnToggleFullScreen();
0115:     afx_msg void OnChangeDevice();
0116:     //}}AFX_MSG
0117:     DECLARE_MESSAGE_MAP()
0118: //  afx_msg void OnBnClickedButtonCheckDeviceFormat();
0119:     BOOL m_bCheckRenderTarget;
0120:     BOOL m_bCheckDepthStencil;
0121:     BOOL m_bCheckDynamic;
0122:     BOOL m_bCheckAutoGenMipmap;
0123:     BOOL m_bCheckDMap;
0124:     int m_iResourceType;
0125:     afx_msg void OnBnClickedCheckRendertarget();
0126:     afx_msg void OnBnClickedButton1();
0127:     afx_msg void OnBnClickedButtonCheckDeviceFormat();
0128: };
0129: 
0130: 
0131: 
0132: 
0133: //-----------------------------------------------------------------------------
0134: // Name: class CAppDoc
0135: // Desc: Overridden CDocument class needed for the CFormView
0136: //-----------------------------------------------------------------------------
0137: class CAppDoc : public CDocument
0138: {
0139: protected:
0140:     DECLARE_DYNCREATE(CAppDoc)
0141: 
0142: // Overrides
0143:     // ClassWizard generated virtual function overrides
0144:     //{{AFX_VIRTUAL(CAppDoc)
0145:     public:
0146:     //}}AFX_VIRTUAL
0147: 
0148: // Implementation
0149:     //{{AFX_MSG(CAppDoc)
0150:         // NOTE - the ClassWizard will add and remove member functions here.
0151:         //    DO NOT EDIT what you see in these blocks of generated code !
0152:     //}}AFX_MSG
0153:     DECLARE_MESSAGE_MAP()
0154: };
0155: 
0156: 
0157: 
0158: 
0159: //-----------------------------------------------------------------------------
0160: // Name: class CAppFrameWnd
0161: // Desc: CFrameWnd-based class needed to override the CFormView's window style
0162: //-----------------------------------------------------------------------------
0163: class CAppFrameWnd : public CFrameWnd
0164: {
0165: protected:
0166:     DECLARE_DYNCREATE(CAppFrameWnd)
0167: public:
0168:     // ClassWizard generated virtual function overrides
0169:     //{{AFX_VIRTUAL(CAppFrameWnd)
0170:     public:
0171:     virtual BOOL PreCreateWindow( CREATESTRUCT& cs );
0172:     virtual BOOL LoadFrame(UINT nIDResource, DWORD dwDefaultStyle = WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, CWnd* pParentWnd = NULL, CCreateContext* pContext = NULL);
0173:     //}}AFX_VIRTUAL
0174: 
0175: protected:
0176:     //{{AFX_MSG(CAppFrameWnd)
0177:     afx_msg void OnChangeDevice();
0178:     //}}AFX_MSG
0179:     DECLARE_MESSAGE_MAP()
0180: };
0181: 
0182: 
0183: 
0184: 
0185: //-----------------------------------------------------------------------------
0186: // Name: class CApp
0187: // Desc: Main MFC application class derived from CWinApp.
0188: //-----------------------------------------------------------------------------
0189: class CApp : public CWinApp
0190: {
0191: public:
0192: 
0193: // Overrides
0194:     // ClassWizard generated virtual function overrides
0195:     //{{AFX_VIRTUAL(CApp)
0196:     public:
0197:     virtual BOOL InitInstance();
0198:     virtual BOOL OnIdle( LONG );
0199:     //}}AFX_VIRTUAL
0200: 
0201: // Implementation
0202:     //{{AFX_MSG(CApp)
0203:     //}}AFX_MSG
0204:     DECLARE_MESSAGE_MAP()
0205: };
0206: 
0207: 
0208: 
0209: 
0210: