0001:
0002:
0003:
0004:
0005:
0006: #pragma once
0007: #include "CShadowVolume.h"
0008:
0009:
0010:
0011:
0012:
0013:
0014:
0015: #define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\main")
0016:
0017:
0018: struct UserInput
0019: {
0020:
0021: BOOL bRotateUp;
0022: BOOL bRotateDown;
0023: BOOL bRotateLeft;
0024: BOOL bRotateRight;
0025: };
0026:
0027:
0028:
0029:
0030:
0031:
0032: class CBigSquare {
0033: private:
0034: typedef struct {
0035: D3DXVECTOR4 p;
0036: D3DCOLOR color;
0037: } SHADOWVERTEX;
0038: static const DWORD FVF;
0039:
0040: LPDIRECT3DVERTEXBUFFER9 m_pVB;
0041: public:
0042: CBigSquare();
0043: HRESULT Create( LPDIRECT3DDEVICE9 pd3dDevice );
0044: void RestoreDeviceObjects( FLOAT sx, FLOAT sy );
0045: void Destroy();
0046: void Render( LPDIRECT3DDEVICE9 pd3dDevice );
0047: };
0048:
0049:
0050:
0051:
0052:
0053:
0054:
0055: class CMyD3DApplication : public CD3DApplication
0056: {
0057: CBigSquare* m_pBigSquare;
0058: CD3DMesh* m_pMeshBG;
0059: CD3DMesh* m_pMeshBox;
0060: CShadowVolume* m_pShadowBox;
0061:
0062:
0063: LPD3DXEFFECT m_pFx;
0064: D3DXHANDLE m_hmWVP;
0065: D3DXHANDLE m_hvPos;
0066:
0067: BOOL m_bLoadingApp;
0068: CD3DFont* m_pFont;
0069: UserInput m_UserInput;
0070:
0071: D3DXMATRIX m_mView;
0072: D3DXMATRIX m_mProj;
0073: D3DXVECTOR3 m_LighPos;
0074:
0075: FLOAT m_fWorldRotX;
0076: FLOAT m_fWorldRotY;
0077:
0078: protected:
0079: virtual HRESULT OneTimeSceneInit();
0080: virtual HRESULT InitDeviceObjects();
0081: virtual HRESULT RestoreDeviceObjects();
0082: virtual HRESULT InvalidateDeviceObjects();
0083: virtual HRESULT DeleteDeviceObjects();
0084: virtual HRESULT Render();
0085: virtual HRESULT FrameMove();
0086: virtual HRESULT FinalCleanup();
0087: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT, D3DFORMAT );
0088:
0089: HRESULT RenderText();
0090:
0091: void UpdateInput( UserInput* pUserInput );
0092: public:
0093: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0094: CMyD3DApplication();
0095: virtual ~CMyD3DApplication();
0096: };
0097:
0098: