Describes the D3DInterface and all its constants
D3D Interface | Describes the D3DInterface and all its constants |
Flags | Used to keep track of the valid modes in D3DInterface |
Enumerations | |
D3D_STATE_TYP | Used to describe the state of the D3DInterface class |
D3DInterface | This is the main interface into Direct3D. |
D3DInterface | Gets a handle to the DIRECT3D9 Interface if there is none already |
~D3DInterface | Closes the interface, but does not shutdown the handle unless explicitely told to. |
Access Functions | The first two do not require any interface and are declared static so anything can access them. |
getState | Gets the current state of the D3DInterface |
getFlags | Gets the current flags of the D3DInterface |
TestState | Tests the coop mode and adjust the state as neccessary |
EnumDisplayModes | Fills the windows control with all the available display modes. |
CheckoutDevice | Use the D3DDevice for using these functions to stay exception safe. |
ReturnDevice | Use the D3DDevice for using these functions to stay exception safe. |
Static Functions | |
InitDevice | Uses the startup settings from CStartup to setup the display mode |
ResetDevice | Uses the previous init settings to recreate a lost device |
__WindowedMode | Get the ResetDevice ready windowed mode |
__FullscreenMode | Get the ResetDevice ready fullscreen mode |
__Resize | Resizes the backbuffer from a window size change |
ShutdownDevice | Shutsdown all the D3D Interfaces. |
Exception Classes | |
xD3DCreateFailed | This is thrown when the interface is unable to Query a D3D COM object |
xD3DEnumFailed | This is thrown when the interface is unable to Enumerate the display modes available. |
D3DDevice | This will grab the D3D Device in an exception-safe way. |
D3DDevice | Grabs a Direct3DDevice9 from the D3D Interface and stores the ID. |
~D3DDevice | If there is a device attached, it returns it with the ID saved in the constructor |
Operators | |
operator-> | Indirection operator so you can use this class as if its the device. |
operator LPDIRECT3DDEVICE9 | Used to provide the class directly whenever a function needs a D3DDevice pointer |
operator! | Polls wether a D3DDevice has been checkout or not |
Functions | |
ReturnDevice | Returns the device before the class goes out of scope |
Used to keep track of the valid modes in D3DInterface
D3D_A1R5G5B5 | 16bit RGBA Mode |
D3D_A2R10G10B10 | 32bit 10bit Channel RGBA Mode |
D3D_A8R8G8B8 | 32bit 8bit Channel RGBA Mode |
D3D_R5G6B5 | 16bit RGB Mode |
D3D_X1R5G5B5 | 16bit RGB Mode |
D3D_X8R8G8B8 | 32bit RGB Mode |
D3D_SOFTWARE | Uses Software Vertex Processing |
D3D_MIXED | Uses a mix of Software and Hardware Vertex Processing |
D3D_HARDWARE | Uses Hardware Vertex Processing |
class D3DInterface
This is the main interface into Direct3D. Mainly used by the Startup to setup all the mode and to prepare the surfaces.
D3DInterface | Gets a handle to the DIRECT3D9 Interface if there is none already |
~D3DInterface | Closes the interface, but does not shutdown the handle unless explicitely told to. |
Access Functions | The first two do not require any interface and are declared static so anything can access them. |
getState | Gets the current state of the D3DInterface |
getFlags | Gets the current flags of the D3DInterface |
TestState | Tests the coop mode and adjust the state as neccessary |
EnumDisplayModes | Fills the windows control with all the available display modes. |
CheckoutDevice | Use the D3DDevice for using these functions to stay exception safe. |
ReturnDevice | Use the D3DDevice for using these functions to stay exception safe. |
Static Functions | |
InitDevice | Uses the startup settings from CStartup to setup the display mode |
ResetDevice | Uses the previous init settings to recreate a lost device |
__WindowedMode | Get the ResetDevice ready windowed mode |
__FullscreenMode | Get the ResetDevice ready fullscreen mode |
__Resize | Resizes the backbuffer from a window size change |
ShutdownDevice | Shutsdown all the D3D Interfaces. |
Exception Classes | |
xD3DCreateFailed | This is thrown when the interface is unable to Query a D3D COM object |
xD3DEnumFailed | This is thrown when the interface is unable to Enumerate the display modes available. |
D3DInterface()
Gets a handle to the DIRECT3D9 Interface if there is none already
xD3DCreateFailed if it fails to create a handle
static D3D_STATE_TYP getState()
Gets the current state of the D3DInterface
D3D_STATE_TYP for the current running mode
static D3D_STATE_TYP TestState()
Tests the coop mode and adjust the state as neccessary
D3D_STATE_TYP with the new state the Interface is in
int EnumDisplayModes ( const HWND hwnd, const int rcResource ) const
Fills the windows control with all the available display modes. Not Static and requires an interface to Direct3D9, but not to Direct3DDevice9.
The window pointer to by the HWND will now contain all of the available display modes in this format.
WidthxHeight hz Color=D3DFORMAT_RGBSTRING
hwnd | HWND The window with the control to fill |
rcResource | INT the control ID in the window to fill |
False if successful, error code otherwise.
xD3DEnumFailed if unable to grab any data.
const LPDIRECT3DDEVICE9 CheckoutDevice( int & ID )
Use the D3DDevice for using these functions to stay exception safe.
This function will checkout a Direct3DDevice9 for use.
ID | INT This is filled with an unique ID that must be returned to the ReturnDevice to avoid an assertion error. |
LPDIRECT3DDEVICE9 for the current running mode. Locks a mutex until ReturnDevice is called.
void ReturnDevice( int & ID )
Use the D3DDevice for using these functions to stay exception safe.
Returns the device that was sent by CheckoutDevice
ID | INT This must be the same ID number that was filled into it by CheckoutDevice |
static int InitDevice( const HWND hwnd )
Uses the startup settings from CStartup to setup the display mode
hwnd | HWND Used to specify which window the device will be created for |
False if succesful, error code otherwise.
static int __WindowedMode()
Get the ResetDevice ready windowed mode
False if successful, error code otherwise
static int __FullscreenMode()
Get the ResetDevice ready fullscreen mode
False if successful, error code otherwise
class D3DDevice : public boost::noncopyable
This will grab the D3D Device in an exception-safe way. When D3DInterface is in D3D_STATE_READY, it allows you to use the indirection operator-> to access the device type directly.
D3DDevice | Grabs a Direct3DDevice9 from the D3D Interface and stores the ID. |
~D3DDevice | If there is a device attached, it returns it with the ID saved in the constructor |
Operators | |
operator-> | Indirection operator so you can use this class as if its the device. |
operator LPDIRECT3DDEVICE9 | Used to provide the class directly whenever a function needs a D3DDevice pointer |
operator! | Polls wether a D3DDevice has been checkout or not |
Functions | |
ReturnDevice | Returns the device before the class goes out of scope |
This is the main interface into Direct3D.
class D3DInterface
Gets a handle to the DIRECT3D9 Interface if there is none already
D3DInterface()
Closes the interface, but does not shutdown the handle unless explicitely told to.
~D3DInterface()
Gets the current state of the D3DInterface
static D3D_STATE_TYP getState()
Gets the current flags of the D3DInterface
static DWORD getFlags()
Tests the coop mode and adjust the state as neccessary
static D3D_STATE_TYP TestState()
Fills the windows control with all the available display modes.
int EnumDisplayModes ( const HWND hwnd, const int rcResource ) const
Use the D3DDevice for using these functions to stay exception safe.
const LPDIRECT3DDEVICE9 CheckoutDevice( int & ID )
This will grab the D3D Device in an exception-safe way.
class D3DDevice : public boost::noncopyable
Use the D3DDevice for using these functions to stay exception safe.
void ReturnDevice( int & ID )
Uses the startup settings from CStartup to setup the display mode
static int InitDevice( const HWND hwnd )
Interface to control and query the running state of the program.
class CStartup
Uses the previous init settings to recreate a lost device
static int ResetDevice()
Get the ResetDevice ready windowed mode
static int __WindowedMode()
Get the ResetDevice ready fullscreen mode
static int __FullscreenMode()
Resizes the backbuffer from a window size change
static int __Resize()
Shutsdown all the D3D Interfaces.
static void ShutdownDevice()
Grabs a Direct3DDevice9 from the D3D Interface and stores the ID.
D3DDevice( ) : d3ddev(NULL), id3d(), ID(0)
If there is a device attached, it returns it with the ID saved in the constructor
~D3DDevice()
Indirection operator so you can use this class as if its the device.
const LPDIRECT3DDEVICE9 operator->() const
Used to provide the class directly whenever a function needs a D3DDevice pointer
operator LPDIRECT3DDEVICE9() const
Polls wether a D3DDevice has been checkout or not
BOOL operator!() const
Returns the device before the class goes out of scope
void ReturnDevice( void )