SIC_EDITOR.H
#pragma once
// include the basic windows header files and the Direct3D header files
#include <windows.h>
#include <windowsx.h>
#include <d3d11.h>
#include <d3dx11.h>
#include <d3dx10.h>
#include <tchar.h>
// include the Direct3D Library file
#pragma comment (lib, "d3d11.lib")
#pragma comment (lib, "d3dx11.lib")
#pragma comment (lib, "d3dx10.lib")
using namespace System;
namespace SIC_Editor {
public ref class Device
{
public:
// function prototypes
static void Init(HWND hWnd); // sets up and initializes Direct3D
static void Render(void); // renders a single frame
static void Clear(void); // closes Direct3D and releases memory
};
}
SIC_EDITOR.CPP
#include "stdafx.h"
#include "SIC_Editor.h"
namespace SIC_Editor {
// global declarations
static public IDXGISwapChain *swapchain; // the pointer to the swap chain interface
static public ID3D11Device *dev; // the pointer to our Direct3D device interface
static public ID3D11DeviceContext *devcon; // the pointer to our Direct3D device context
static public ID3D11RenderTargetView *backbuffer; // the pointer to our back buffer
// this function initializes and prepares Direct3D for use
void Device::Init(HWND hWnd)
{
// create a struct to hold information about the swap chain
DXGI_SWAP_CHAIN_DESC scd;
// clear out the struct for use
ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));
// fill the swap chain description struct
scd.BufferCount = 1; // one back buffer
scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // use 32-bit color
scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // how swap chain is to be used
scd.OutputWindow = hWnd; // the window to be used
scd.SampleDesc.Count = 1; // how many multisamples
scd.SampleDesc.Quality = 0; // multisample quality level
scd.Windowed = TRUE; // windowed/full-screen mode
// create a device, device context and swap chain using the information in the scd struct
D3D11CreateDeviceAndSwapChain(NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
NULL,
NULL,
NULL,
D3D11_SDK_VERSION,
&scd,
&swapchain,
&dev,
NULL,
&devcon);
// get the address of the back buffer
ID3D11Texture2D *pBackBuffer;
swapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
// use the back buffer address to create the render target
dev->CreateRenderTargetView(pBackBuffer, NULL, &backbuffer);
pBackBuffer->Release();
// set the render target as the back buffer
devcon->OMSetRenderTargets(1, &backbuffer, NULL);
// Set the viewport
D3D11_VIEWPORT viewport;
ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = 800;
viewport.Height = 600;
devcon->RSSetViewports(1, &viewport);
}
This is the windows form in C++ that's giving the function candidate issue.
private: System::Void DX9Form_Shown(System::Object^ sender, System::EventArgs^ e)
{
SIC_Editor::Device::Init(hDX9);
SIC_Editor::Device::Render();
}
The windows form C++ is in another project. I figured i just make a managed framework I can work in for simplicity sake.
Thanks for pointing me in the right direction guys! Much appreciated!

New Topic/Question
Reply


MultiQuote





|