Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <swap_chain.h>
Public Member Functions | |
void | Create (HWND output_window, UINT width, UINT height, DXGI_FORMAT format, UINT buffer_count, DXGI_SWAP_EFFECT swap_effect, UINT flags, bool disable_alt_enter=true, bool windowed=true) |
void | Present (bool vsync=true) |
ColorBuffer & | GetBuffer (UINT buffer_index) |
const ColorBuffer & | GetBuffer (UINT buffer_index) const |
ColorBuffer & | GetBackBuffer () |
const ColorBuffer & | GetBackBuffer () const |
const UINT & | GetBufferCount () const |
const UINT & | GetBackBufferIndex () const |
const UINT & | GetBufferWidth () const |
const UINT & | GetBufferHeight () const |
operator IDXGISwapChain * () | |
IDXGISwapChain * | operator-> () |
const IDXGISwapChain * | operator-> () const |
Protected Member Functions | |
DXGI_SWAP_CHAIN_DESC | DescribeSwapChain (HWND output_window, UINT width, UINT height, DXGI_FORMAT format, UINT buffer_count, DXGI_SWAP_EFFECT swap_effect, UINT flags, bool windowed=true) |
Private Attributes | |
IDXGISwapChain * | swap_chain_ |
DXGI_SWAP_CHAIN_DESC | desc_ |
UINT | back_buffer_index_ |
UINT | buffer_count_ |
ColorBuffer | buffers_ [SWAP_CHAIN_MAX_BUFFER_COUNT] |
Wraps the IDXGISwapChain.
This class wraps all the functionality of a IDXGISwapChain. It creates the ColorBuffers for the back buffers and makes it easy to swap the buffers via Present calls.
void blowbox::SwapChain::Create | ( | HWND | output_window, |
UINT | width, | ||
UINT | height, | ||
DXGI_FORMAT | format, | ||
UINT | buffer_count, | ||
DXGI_SWAP_EFFECT | swap_effect, | ||
UINT | flags, | ||
bool | disable_alt_enter = true , |
||
bool | windowed = true |
||
) |
Creates the actual SwapChain.
[in] | output_window | The output window to which the SwapChain has to bind. |
[in] | width | The width of the output window. |
[in] | height | The height of the output window. |
[in] | format | The formats you want to use for the back buffers. |
[in] | buffer_count | The number of back buffers that should be created. |
[in] | swap_effect | The swap effect that should be used when Presenting to the output window. |
[in] | flags | Any flags that should be attached to the swap chain. |
[in] | disable_alt_enter | Whether alt-enter (for fullscreen stuff) should be disabled. |
[in] | windowed | Whether the swap chain should be windowed or fullscreen. |
|
protected |
Creates a DXGI_SWAP_CHAIN_DESC based on input params.
[in] | output_window | The window that should be output into. |
[in] | width | The width of the of the SwapChain buffers. |
[in] | height | The height of the SwapChain buffers. |
[in] | format | The format for the SwapChain buffers. |
[in] | buffer_count | The number of buffers in the SwapChain. |
[in] | swap_effect | The swap effect that should be used when swapping out presenting buffers. |
[in] | flags | Any flags that should be set on the SwapChain. |
[in] | windowed | Whether the swap chain should be windowed or not. |
|
inline |
|
inline |
|
inline |
|
inline |
Retrieve a certain buffer from the SwapChain buffers.
[in] | buffer_index | An index into the SwapChain buffers array. |
|
inline |
Retrieve a certain buffer from the SwapChain buffers.
[in] | buffer_index | An index into the SwapChain buffers array. |
|
inline |
|
inline |
|
inline |
|
inline |
Implicit cast to a IDXGISwapChain.
|
inline |
Overloads the pointer operator to return the underlying IDXGISwapChain.
|
inline |
Overloads the pointer operator to return the underlying IDXGISwapChain.
void blowbox::SwapChain::Present | ( | bool | vsync = true | ) |
Presents the back buffer to the screen.
[in] | vsync | Whether the present call should wait for the next V_BLANK. (i.e. whether to use vsync or not) |
|
private |
The current back buffer index.
|
private |
The number of buffers in use by the SwapChain.
|
private |
All the different SwapChain buffers.
|
private |
The description of the IDXGISwapChain.
|
private |
The underlying IDXGISwapChain.