📄 pig_test.h
字号:
//-----------------------------------------------------------------------------
// File: pig_test.h
//
// Desc: Header file pig_test sample app
//-----------------------------------------------------------------------------
#pragma once
//-----------------------------------------------------------------------------
// Defines, and constants
//-----------------------------------------------------------------------------
// TODO: change "DirectX AppWizard Apps" to your name or the company name
#define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\pig_test")
// DirectInput action mapper reports events only when buttons/axis change
// so we need to remember the present state of relevant axis/buttons for
// each DirectInput device. The CInputDeviceManager will store a
// pointer for each device that points to this struct
struct InputDeviceState
{
// TODO: change as needed
FLOAT fAxisRotateLR;
BOOL bButtonRotateLeft;
BOOL bButtonRotateRight;
FLOAT fAxisRotateUD;
BOOL bButtonRotateUp;
BOOL bButtonRotateDown;
BOOL bButtonPlaySoundButtonDown;
};
// Struct to store the current input state
struct UserInput
{
// TODO: change as needed
FLOAT fAxisRotateUD;
FLOAT fAxisRotateLR;
BOOL bPlaySoundButtonDown;
BOOL bDoConfigureInput;
BOOL bDoConfigureDisplay;
};
//-----------------------------------------------------------------------------
// Name: class CMyD3DApplication
// Desc: Application class. The base class (CD3DApplication) provides the
// generic functionality needed in all Direct3D samples. CMyD3DApplication
// adds functionality specific to this sample program.
//-----------------------------------------------------------------------------
class CMyD3DApplication : public CD3DApplication
{
CD3DMesh* m_pMesh;
BOOL m_bLoadingApp; // TRUE, if the app is loading
CD3DFont* m_pFont; // Font for drawing text
CInputDeviceManager* m_pInputDeviceManager; // DirectInput device manager
DIACTIONFORMAT m_diafGame; // Action format for game play
LPDIRECT3DSURFACE9 m_pDIConfigSurface; // Surface for config'ing DInput devices
UserInput m_UserInput; // Struct for storing user input
FLOAT m_fSoundPlayRepeatCountdown; // Sound repeat timer
CMusicManager* m_pMusicManager; // DirectMusic manager class
CMusicSegment* m_pBounceSound; // Bounce sound
FLOAT m_fWorldRotX; // World rotation state X-axis
FLOAT m_fWorldRotY; // World rotation state Y-axis
protected:
virtual HRESULT OneTimeSceneInit();
virtual HRESULT InitDeviceObjects();
virtual HRESULT RestoreDeviceObjects();
virtual HRESULT InvalidateDeviceObjects();
virtual HRESULT DeleteDeviceObjects();
virtual HRESULT Render();
virtual HRESULT FrameMove();
virtual HRESULT FinalCleanup();
virtual HRESULT ConfirmDevice( D3DCAPS9*, DWORD, D3DFORMAT );
VOID Pause( bool bPause );
HRESULT RenderText();
HRESULT InitInput( HWND hWnd );
void UpdateInput( UserInput* pUserInput );
void CleanupDirectInput();
void KeyBoardMove(void);
HRESULT InitAudio( HWND hWnd );
VOID ReadSettings();
VOID WriteSettings();
public:
LRESULT MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
CMyD3DApplication();
virtual ~CMyD3DApplication();
HRESULT InputAddDeviceCB( CInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi );
static HRESULT CALLBACK StaticInputAddDeviceCB( CInputDeviceManager::DeviceInfo* pDeviceInfo, const DIDEVICEINSTANCE* pdidi, LPVOID pParam );
BOOL ConfigureInputDevicesCB( IUnknown* pUnknown );
static BOOL CALLBACK StaticConfigureInputDevicesCB( IUnknown* pUnknown, VOID* pUserData );
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -