?? dxut.cpp
字號(hào):
bool m_OverrideConstantFrameTime; // if true, then force to constant frame time
float m_OverrideConstantTimePerFrame; // the constant time per frame in seconds if m_OverrideConstantFrameTime==true
int m_OverrideQuitAfterFrame; // if != 0, then it will force the app to quit after that frame
int m_OverrideForceVsync; // if == 0, then it will force the app to use D3DPRESENT_INTERVAL_IMMEDIATE, if == 1 force use of D3DPRESENT_INTERVAL_DEFAULT
bool m_OverrideRelaunchMCE; // if true, then force relaunch of MCE at exit
bool m_ReleasingSwapChain; // if true, the app is releasing its swapchain
LPDXUTCALLBACKMODIFYDEVICESETTINGS m_ModifyDeviceSettingsFunc; // modify Direct3D device settings callback
LPDXUTCALLBACKDEVICEREMOVED m_DeviceRemovedFunc; // Direct3D device removed callback
LPDXUTCALLBACKFRAMEMOVE m_FrameMoveFunc; // frame move callback
LPDXUTCALLBACKKEYBOARD m_KeyboardFunc; // keyboard callback
LPDXUTCALLBACKMOUSE m_MouseFunc; // mouse callback
LPDXUTCALLBACKMSGPROC m_WindowMsgFunc; // window messages callback
LPDXUTCALLBACKISD3D9DEVICEACCEPTABLE m_IsD3D9DeviceAcceptableFunc; // D3D9 is device acceptable callback
LPDXUTCALLBACKD3D9DEVICECREATED m_D3D9DeviceCreatedFunc; // D3D9 device created callback
LPDXUTCALLBACKD3D9DEVICERESET m_D3D9DeviceResetFunc; // D3D9 device reset callback
LPDXUTCALLBACKD3D9DEVICELOST m_D3D9DeviceLostFunc; // D3D9 device lost callback
LPDXUTCALLBACKD3D9DEVICEDESTROYED m_D3D9DeviceDestroyedFunc; // D3D9 device destroyed callback
LPDXUTCALLBACKD3D9FRAMERENDER m_D3D9FrameRenderFunc; // D3D9 frame render callback
LPDXUTCALLBACKISD3D10DEVICEACCEPTABLE m_IsD3D10DeviceAcceptableFunc; // D3D10 is device acceptable callback
LPDXUTCALLBACKD3D10DEVICECREATED m_D3D10DeviceCreatedFunc; // D3D10 device created callback
LPDXUTCALLBACKD3D10SWAPCHAINRESIZED m_D3D10SwapChainResizedFunc; // D3D10 SwapChain reset callback
LPDXUTCALLBACKD3D10SWAPCHAINRELEASING m_D3D10SwapChainReleasingFunc; // D3D10 SwapChain lost callback
LPDXUTCALLBACKD3D10DEVICEDESTROYED m_D3D10DeviceDestroyedFunc; // D3D10 device destroyed callback
LPDXUTCALLBACKD3D10FRAMERENDER m_D3D10FrameRenderFunc; // D3D10 frame render callback
void* m_ModifyDeviceSettingsFuncUserContext; // user context for modify Direct3D device settings callback
void* m_DeviceRemovedFuncUserContext; // user context for Direct3D device removed callback
void* m_FrameMoveFuncUserContext; // user context for frame move callback
void* m_KeyboardFuncUserContext; // user context for keyboard callback
void* m_MouseFuncUserContext; // user context for mouse callback
void* m_WindowMsgFuncUserContext; // user context for window messages callback
void* m_IsD3D9DeviceAcceptableFuncUserContext; // user context for is D3D9 device acceptable callback
void* m_D3D9DeviceCreatedFuncUserContext; // user context for D3D9 device created callback
void* m_D3D9DeviceResetFuncUserContext; // user context for D3D9 device reset callback
void* m_D3D9DeviceLostFuncUserContext; // user context for D3D9 device lost callback
void* m_D3D9DeviceDestroyedFuncUserContext; // user context for D3D9 device destroyed callback
void* m_D3D9FrameRenderFuncUserContext; // user context for D3D9 frame render callback
void* m_IsD3D10DeviceAcceptableFuncUserContext; // user context for is D3D10 device acceptable callback
void* m_D3D10DeviceCreatedFuncUserContext; // user context for D3D10 device created callback
void* m_D3D10SwapChainResizedFuncUserContext; // user context for D3D10 SwapChain resized callback
void* m_D3D10SwapChainReleasingFuncUserContext; // user context for D3D10 SwapChain releasing callback
void* m_D3D10DeviceDestroyedFuncUserContext; // user context for D3D10 device destroyed callback
void* m_D3D10FrameRenderFuncUserContext; // user context for D3D10 frame render callback
bool m_Keys[256]; // array of key state
bool m_MouseButtons[5]; // array of mouse states
CGrowableArray<DXUT_TIMER>* m_TimerList; // list of DXUT_TIMER structs
WCHAR m_StaticFrameStats[256]; // static part of frames stats
WCHAR m_FPSStats[64]; // fps stats
WCHAR m_FrameStats[256]; // frame stats (fps, width, etc)
WCHAR m_DeviceStats[256]; // device stats (description, device type, etc)
WCHAR m_D3D10CounterStats[DXUT_COUNTER_STAT_LENGTH]; // d3d10 pipeline statistics
WCHAR m_WindowTitle[256]; // window title
};
STATE m_state;
public:
DXUTState() { Create(); }
~DXUTState() { Destroy(); }
void Create()
{
g_bThreadSafe = true;
InitializeCriticalSection( &g_cs );
ZeroMemory( &m_state, sizeof(STATE) );
m_state.m_OverrideStartX = -1;
m_state.m_OverrideStartY = -1;
m_state.m_OverrideForceAPI = -1;
m_state.m_OverrideAdapterOrdinal = -1;
m_state.m_OverrideOutput = -1;
m_state.m_OverrideForceVsync = -1;
m_state.m_AutoChangeAdapter = true;
m_state.m_ShowMsgBoxOnError = true;
m_state.m_AllowShortcutKeysWhenWindowed = true;
m_state.m_Active = true;
m_state.m_CallDefWindowProc = true;
m_state.m_HandleEscape = true;
m_state.m_HandleAltEnter = true;
m_state.m_HandlePause = true;
m_state.m_CounterData.fGPUIdle = -1.0f;
m_state.m_CounterData.fVertexProcessing = -1.0f;
m_state.m_CounterData.fGeometryProcessing = -1.0f;
m_state.m_CounterData.fPixelProcessing = -1.0f;
m_state.m_CounterData.fOtherGPUProcessing = -1.0f;
m_state.m_CounterData.fHostAdapterBandwidthUtilization = -1.0f;
m_state.m_CounterData.fLocalVidmemBandwidthUtilization = -1.0f;
m_state.m_CounterData.fVertexThroughputUtilization = -1.0f;
m_state.m_CounterData.fTriangleSetupThroughputUtilization = -1.0f;
m_state.m_CounterData.fFillrateThroughputUtilization = -1.0f;
m_state.m_CounterData.fVSMemoryLimited = -1.0f;
m_state.m_CounterData.fVSComputationLimited = -1.0f;
m_state.m_CounterData.fGSMemoryLimited = -1.0f;
m_state.m_CounterData.fGSComputationLimited = -1.0f;
m_state.m_CounterData.fPSMemoryLimited = -1.0f;
m_state.m_CounterData.fPSComputationLimited = -1.0f;
m_state.m_CounterData.fPostTransformCacheHitRate = -1.0f;
m_state.m_CounterData.fTextureCacheHitRate = -1.0f;
}
void Destroy()
{
SAFE_DELETE( m_state.m_TimerList );
DXUTShutdown();
DeleteCriticalSection( &g_cs );
}
// Macros to define access functions for thread safe access into m_state
// D3D9 specific
GET_SET_ACCESSOR( IDirect3D9*, D3D9 );
GET_SET_ACCESSOR( IDirect3DDevice9*, D3D9Device );
GET_SET_ACCESSOR( DXUTDeviceSettings*, CurrentDeviceSettings );
GETP_SETP_ACCESSOR( D3DSURFACE_DESC, BackBufferSurfaceDesc9 );
GETP_SETP_ACCESSOR( D3DCAPS9, Caps );
// D3D10 specific
GET_SET_ACCESSOR( bool, D3D10Available );
GET_SET_ACCESSOR( IDXGIFactory*, DXGIFactory );
GET_SET_ACCESSOR( IDXGIAdapter*, D3D10Adapter );
GET_SET_ACCESSOR( IDXGIOutput**, D3D10OutputArray );
GET_SET_ACCESSOR( UINT, D3D10OutputArraySize );
GET_SET_ACCESSOR( ID3D10Device*, D3D10Device );
GET_SET_ACCESSOR( IDXGISwapChain*, D3D10SwapChain );
GET_SET_ACCESSOR( ID3D10Texture2D*, D3D10DepthStencil );
GET_SET_ACCESSOR( ID3D10DepthStencilView*, D3D10DepthStencilView );
GET_SET_ACCESSOR( ID3D10RenderTargetView*, D3D10RenderTargetView );
GETP_SETP_ACCESSOR( DXGI_SURFACE_DESC, BackBufferSurfaceDesc10 );
GET_SET_ACCESSOR( bool, RenderingOccluded );
GET_SET_ACCESSOR( bool, DoNotStoreBufferSize );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_GPUIdle );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_VertexProcessing );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_GeometryProcessing );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_PixelProcessing );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_OtherGPUProcessing );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_HostAdapterBandwidthUtilization );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_LocalVidmemBandwidthUtilization );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_VertexThroughputUtilization );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_TriangleSetupThroughputUtilization );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_FillrateThrougputUtilization );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_VSMemoryLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_VSComputationLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_GSMemoryLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_GSComputationLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_PSMemoryLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_PSComputationLimited );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_PostTransformCacheHitRate );
GET_SET_ACCESSOR( ID3D10Counter*, Counter_TextureCacheHitRate );
GETP_SETP_ACCESSOR( D3D10_COUNTERS, CounterData );
GET_SET_ACCESSOR( HWND, HWNDFocus );
GET_SET_ACCESSOR( HWND, HWNDDeviceFullScreen );
GET_SET_ACCESSOR( HWND, HWNDDeviceWindowed );
GET_SET_ACCESSOR( HMONITOR, AdapterMonitor );
GET_SET_ACCESSOR( HMENU, Menu );
GET_SET_ACCESSOR( UINT, FullScreenBackBufferWidthAtModeChange );
GET_SET_ACCESSOR( UINT, FullScreenBackBufferHeightAtModeChange );
GET_SET_ACCESSOR( UINT, WindowBackBufferWidthAtModeChange );
GET_SET_ACCESSOR( UINT, WindowBackBufferHeightAtModeChange );
GETP_SETP_ACCESSOR( WINDOWPLACEMENT, WindowedPlacement );
GET_SET_ACCESSOR( DWORD, WindowedStyleAtModeChange );
GET_SET_ACCESSOR( bool, TopmostWhileWindowed );
GET_SET_ACCESSOR( bool, Minimized );
GET_SET_ACCESSOR( bool, Maximized );
GET_SET_ACCESSOR( bool, MinimizedWhileFullscreen );
GET_SET_ACCESSOR( bool, IgnoreSizeChange );
GET_SET_ACCESSOR( double, Time );
GET_SET_ACCESSOR( double, AbsoluteTime );
GET_SET_ACCESSOR( float, ElapsedTime );
GET_SET_ACCESSOR( HINSTANCE, HInstance );
GET_SET_ACCESSOR( double, LastStatsUpdateTime );
GET_SET_ACCESSOR( DWORD, LastStatsUpdateFrames );
GET_SET_ACCESSOR( float, FPS );
GET_SET_ACCESSOR( int, CurrentFrameNumber );
GET_SET_ACCESSOR( HHOOK, KeyboardHook );
GET_SET_ACCESSOR( bool, AllowShortcutKeysWhenFullscreen );
GET_SET_ACCESSOR( bool, AllowShortcutKeysWhenWindowed );
GET_SET_ACCESSOR( bool, AllowShortcutKeys );
GET_SET_ACCESSOR( bool, CallDefWindowProc );
GET_SET_ACCESSOR( STICKYKEYS, StartupStickyKeys );
GET_SET_ACCESSOR( TOGGLEKEYS, StartupToggleKeys );
GET_SET_ACCESSOR( FILTERKEYS, StartupFilterKeys );
GET_SET_ACCESSOR( bool, AppSupportsD3D9Override );
GET_SET_ACCESSOR( bool, AppSupportsD3D10Override );
GET_SET_ACCESSOR( bool, UseD3DVersionOverride );
GET_SET_ACCESSOR( bool, HandleEscape );
GET_SET_ACCESSOR( bool, HandleAltEnter );
GET_SET_ACCESSOR( bool, HandlePause );
GET_SET_ACCESSOR( bool, ShowMsgBoxOnError );
GET_SET_ACCESSOR( bool, NoStats );
GET_SET_ACCESSOR( bool, ClipCursorWhenFullScreen );
GET_SET_ACCESSOR( bool, ShowCursorWhenFullScreen );
GET_SET_ACCESSOR( bool, ConstantFrameTime );
GET_SET_ACCESSOR( float, TimePerFrame );
GET_SET_ACCESSOR( bool, WireframeMode );
GET_SET_ACCESSOR( bool, AutoChangeAdapter );
GET_SET_ACCESSOR( bool, WindowCreatedWithDefaultPositions );
GET_SET_ACCESSOR( int, ExitCode );
GET_SET_ACCESSOR( bool, DXUTInited );
GET_SET_ACCESSOR( bool, WindowCreated );
GET_SET_ACCESSOR( bool, DeviceCreated );
GET_SET_ACCESSOR( bool, DXUTInitCalled );
GET_SET_ACCESSOR( bool, WindowCreateCalled );
GET_SET_ACCESSOR( bool, DeviceCreateCalled );
GET_SET_ACCESSOR( bool, InsideDeviceCallback );
GET_SET_ACCESSOR( bool, InsideMainloop );
GET_SET_ACCESSOR( bool, DeviceObjectsCreated );
GET_SET_ACCESSOR( bool, DeviceObjectsReset );
GET_SET_ACCESSOR( bool, Active );
GET_SET_ACCESSOR( bool, RenderingPaused );
GET_SET_ACCESSOR( bool, TimePaused );
GET_SET_ACCESSOR( int, PauseRenderingCount );
GET_SET_ACCESSOR( int, PauseTimeCount );
GET_SET_ACCESSOR( bool, DeviceLost );
GET_SET_ACCESSOR( bool, NotifyOnMouseMove );
GET_SET_ACCESSOR( bool, Automation );
GET_SET_ACCESSOR( bool, InSizeMove );
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -