下面列出允许改变DXUT行为和获取内部变量的函数,这些函数在使用DXUT框架的Direct3D程序中是非常实用的。
管理窗口的DXUT函数
函数 |
描述 |
DXUTGetHINSTANCE |
获取应用程序实例的句柄 |
DXUTGetHWND |
获取当前设备窗口的句柄 |
DXUTGetHWNDFocus |
获取当前获得焦点的窗口的句柄 |
DXUTGetHWNDDeviceFullScreen |
获取全屏模式设备窗口的句柄 |
DXUTGetHWNDDeviceWindowed |
获取窗口模式设备窗口的句柄 |
DXUTGetWindowClientRect |
获取应用程序设备窗口的客户区矩形 |
DXUTGetWindowTitle |
获取指向应用程序窗口标题的指针 |
DXUTIsWindowed |
检查应用程序是否处在窗口模式下 |
DXUTGetHINSTANCE
Get a handle to the application instance.
HINSTANCE DXUTGetHINSTANCE();
Parameters
None.
Return Values
A handle to the application instance.
DXUTGetHWND
Get a handle to the current device window.
HWND DXUTGetHWND();
Parameters
None.
Return Values
A handle to the current device window.
DXUTGetHWNDFocus
Get the handle of the focus window.
HWND DXUTGetHWNDFocus();
Parameters
None.
Return Values
Handle to the focus window.
Remarks
The focus window informs Direct3D when the application
is switched to a background window with an ALT+TAB key entry, a mouse click, or
by other means. It is typically the same window as the device window.
DXUTGetHWNDDeviceFullScreen
Get the handle of the device window used when the
application is fullscreen.
HWND DXUTGetHWNDDeviceFullScreen();
Parameters
None.
Return Values
Returns a handle of the device window used when the
application is fullscreen.
DXUTGetHWNDDeviceWindowed
Get the handle of the device window used when the
application is windowed.
HWND DXUTGetHWNDDeviceWindowed();
Parameters
None.
Return Values
Returns a handle of the device window used when the
application is windowed.
DXUTGetWindowClientRect
Get the current client RECT of the application window.
CONST RECT * DXUTGetWindowClientRect();
Parameters
None.
Return Values
Returns the current client RECT of the application
window.
DXUTGetWindowTitle
Get a pointer to a string containing the application
window title.
LPCWSTR DXUTGetWindowTitle();
Parameters
None.
Return Values
Pointer to a string containing the application window
title.
DXUTIsWindowed
Indicates whether the application is in windowed mode.
BOOL DXUTIsWindowed();
Parameters
None.
Return Values
If TRUE, the application is in windowed mode. If the
application is not in windowed mode, or no device exists, then FALSE is
returned.
管理设备的DXUT函数
函数 |
描述 |
DXUTSetCursorSettings |
为全屏模式下光标的用法设置选项 |
DXUTSetMultimonSettings |
为框架如何在多显示器配置中工作设置选项 |
DXUTToggleFullscreen |
使应用程序在窗口模式和全屏模式间切换 |
DXUTToggleREF |
使应用程序在硬件抽象层和参考设备间切换 |
DXUTSetCursorSettings
Sets options for cursor usage in full-screen mode.
HRESULT DXUTSetCursorSettings(
bool bShowCursorWhenFullScreen,
bool bClipCursorWhenFullScreen
);
Parameters
- bShowCursorWhenFullScreen
- [in] Cursor visibility flag. If true, the cursor
will be visible when the application is running in full-screen mode.
- bClipCursorWhenFullScreen
- [in] Cursor clipping flag. If true, the cursor
will be restricted from exiting the screen boundaries when the application
is running in full screen mode.
Return Values
If the function succeeds, the return value is S_OK. If
the function fails, the return value can be one of the error codes in DXUTERR.
DXUTSetMultimonSettings
Sets options for how DXUT functions on multiple
monitors.
VOID DXUTSetMultimonSettings(
BOOL bAutoChangeAdapter
);
Parameters
- bAutoChangeAdapter
- [in] If TRUE and the application window is
relocated to a different monitor, DXUT will automatically change to use the
new monitor's adapter, and device callback functions will be called to
recreate the scene.
Return Values
No return value.
DXUTToggleFullscreen
Switches the application between windowed and
full-screen modes.
HRESULT DXUTToggleFullscreen();
Parameters
None.
Return Values
If the function succeeds, the return value is S_OK. If
the function fails, the return value can be one of the error codes in DXUTERR.
Remarks
This function works regardless of which Direct3D API
version the application is using.
Toggling between windowed and full-screen modes will
result in swap chain being resized if using Direct3D 10, or the device being
reset or recreated if using Direct3D 9.
DXUTToggleREF
Switches the application between HAL and reference
device types.
HRESULT DXUTToggleREF();
Parameters
None.
Return Values
If the function succeeds, the return value is S_OK. If
the function fails, the return value can be one of the error codes in DXUTERR.
Remarks
This function works regardless of which Direct3D API
version the application is using.