#ifndef DXSYSTEM
#define DXSYSTEM
#include "dxD3D.h"
const bool FULL_SCREEN = false;
const float SCREEN_DEPTH = 1000.0f;
const float SCREEN_NEAR = 0.1f;
/**************************************************************************************
* dxSystem
* Simon GL Jordan
* Description:
* The main workhorse of the directX to Windows interface in the engine.
* Handles safe construction and deletion of DirectX resources.
*
* Use:
* All main elements are included here, dxSystem pieces together parts of the engine.
* All rendering and processing is done here of other engine elements, before being
* parsed into winMain
*
* Future Implementations:
* 1. Input system
* 2.System timer
* 3.System resources analysis(memory, disk space)
***************************************************************************************/
dxD3D * m_dxD3D;
class dxSystem
{
private:
HWND* hWnd;
public:
dxSystem();
dxSystem(const dxSystem&);
~dxSystem();
bool initialise(int in_screenWidth, int in_screenHeight, HWND* hW);
bool initialiseObjects(int screenWidth, int screenHeight, HWND hwnd);
void shutDown(){
// Release the m_dxD3D object.
if(m_dxD3D)
{
m_dxD3D->shutDown();
delete m_dxD3D;
m_dxD3D = 0;
}
}
bool render(){
m_dxD3D->beginScene(0.0f, 0.0f, 0.0f, 1.0f);
m_dxD3D->endScene();
return true;
}
};
dxSystem::dxSystem()
{
}
dxSystem::dxSystem(const dxSystem& other)
{
}
dxSystem::~dxSystem()
{}
bool dxSystem::initialise(int in_screenWidth, int in_screenHeight, HWND* hW)
{
m_dxD3D = new dxD3D;
//hWnd = hW;
bool result;
////get window dimensions
//RECT rc;
// GetClientRect( in_hwnd, &rc );
// UINT width = rc.right - rc.left;
// UINT height = rc.bottom - rc.top;
// CREATE DEVICE
//*****************************************************************************
/*if ( !m_dxD3D->createSwapChainAndDevice(width, height, in_hwnd) ) return false;*/
result = m_dxD3D->createSwapChainAndDevice(in_screenWidth, in_screenHeight);
if(FAILED(result))
{
MessageBox(NULL, L"Failed to create the device", NULL, NULL);
return false;
}
// INPUT ASSEMBLY STAGE
//*****************************************************************************
/*if ( !m_dxD3D->loadShadersAndCreateInputLayouts() ) return false;*/
result = m_dxD3D->loadShadersAndCreateInputLayouts();
if(FAILED(result))
{
MessageBox(NULL, L"Failed to create the input assembly stage", NULL, NULL);
return false;
}
// RASTERIZER STAGE SETUP
//*****************************************************************************
m_dxD3D->initRasterizerState();
// OUTPUT-MERGER STAGE
//*****************************************************************************
/*if ( !m_dxD3D->createRenderTargetsAndDepthBuffer(width, height)) return false;*/
result = m_dxD3D->createRenderTargetsAndDepthBuffer(in_screenWidth, in_screenHeight);
if(FAILED(result))
{
MessageBox(NULL, L"Failed to create the output merger stage", NULL, NULL);
return false;
}
return true;
}
#endif