0001:
0002:
0003:
0004:
0005:
0006: #pragma once
0007:
0008:
0009:
0010:
0011:
0012:
0013:
0014:
0015: #define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\DirectX9Application1")
0016:
0017:
0018:
0019:
0020:
0021: struct InputDeviceState
0022: {
0023:
0024: FLOAT fAxisRotateLR;
0025: BOOL bButtonRotateLeft;
0026: BOOL bButtonRotateRight;
0027:
0028: FLOAT fAxisRotateUD;
0029: BOOL bButtonRotateUp;
0030: BOOL bButtonRotateDown;
0031:
0032: BOOL bButtonPlaySoundButtonDown;
0033: };
0034:
0035:
0036:
0037: struct UserInput
0038: {
0039:
0040: FLOAT fAxisRotateUD;
0041: FLOAT fAxisRotateLR;
0042: BOOL bPlaySoundButtonDown;
0043: BOOL bDoConfigureInput;
0044: BOOL bDoConfigureDisplay;
0045: };
0046:
0047:
0048:
0049:
0050:
0051:
0052:
0053:
0054:
0055:
0056: class CMyD3DApplication : public CD3DApplication
0057: {
0058:
0059: LPD3DXEFFECT m_pEffect;
0060: D3DXHANDLE m_hmWVP;
0061:
0062:
0063: D3DXMATRIX m_matWorld;
0064: D3DXMATRIX m_matView;
0065: D3DXMATRIX m_matProj;
0066:
0067: BOOL m_bLoadingApp;
0068: CD3DFont* m_pFont;
0069: ID3DXMesh* m_pD3DXMesh;
0070: CInputDeviceManager* m_pInputDeviceManager;
0071: DIACTIONFORMAT m_diafGame;
0072: LPDIRECT3DSURFACE9 m_pDIConfigSurface;
0073: UserInput m_UserInput;
0074:
0075: FLOAT m_fSoundPlayRepeatCountdown;
0076: CMusicManager* m_pMusicManager;
0077: CMusicSegment* m_pBounceSound;
0078: FLOAT m_fWorldRotX;
0079: FLOAT m_fWorldRotY;
0080:
0081: protected:
0082: virtual HRESULT OneTimeSceneInit();
0083: virtual HRESULT InitDeviceObjects();
0084: virtual HRESULT RestoreDeviceObjects();
0085: virtual HRESULT InvalidateDeviceObjects();
0086: virtual HRESULT DeleteDeviceObjects();
0087: virtual HRESULT Render();
0088: virtual HRESULT FrameMove();
0089: virtual HRESULT FinalCleanup();
0090: virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
0091: VOID Pause( bool bPause );
0092:
0093: HRESULT RenderText();
0094:
0095: HRESULT InitInput( HWND hWnd );
0096: void UpdateInput( UserInput* pUserInput );
0097: void CleanupDirectInput();
0098: HRESULT InitAudio( HWND hWnd );
0099:
0100: VOID ReadSettings();
0101: VOID WriteSettings();
0102:
0103: public:
0104: LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
0105: CMyD3DApplication();
0106: virtual ~CMyD3DApplication();
0107:
0108: HRESULT InputAddDeviceCB( CInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi );
0109: static HRESULT CALLBACK StaticInputAddDeviceCB( CInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi, LPVOID pParam );
0110: BOOL ConfigureInputDevicesCB( IUnknown* pUnknown );
0111: static BOOL CALLBACK StaticConfigureInputDevicesCB( IUnknown* pUnknown, VOID* pUserData );
0112: };
0113:
0114: