Include the headers

#include "Rendering\D2D1Renderer.h"
#include "Objects\Stage.h"

Needed variables

D2D1Renderer* _rendererD2D1;
D2::Stage* _stage;

Initializing the D2D1Renderer and the Stage-Object

bool App::InitializeD2D1Renderer( HWND hwnd, ID3D11Device* dx11Device, int width, int height ) {
    _rendererD2D1 = new D2D1Renderer();
    if(!_rendererD2D1->Initialize(dx11Device, width, height)) {
        return false;
    _stage = new D2::Stage();

    return true;

Update the D2D1Renderer each frame

void App::Update() {

Getting the output resource of  the D2D1Renderer

ID3D11Texture* dx11Texture = _rendererD2D1->GetTexture();

Register the interaction-model on the windows message loop

LRESULT App::WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
    _stage->HandleWindowMessage(hwnd, msg, wparam, lparam);

If the mouse buttons are not working it is necessary to register the mouse for rawInput support.

void App::InitializeRawInput() {

    Rid[0].usUsagePage = 1;
    Rid[0].usUsage = 2;
    Rid[0].dwFlags = 0;
    Rid[0].hwndTarget = NULL;

    if(RegisterRawInputDevices(Rid, 1, sizeof(RAWINPUTDEVICE)) == FALSE) {
        MessageBox(NULL, L"Failed to Register Input Devices!", L"ALERT", MB_OK);

NOTICE: The Config of the SwapChain format of the DirectX11 device has to be  DXGI_FORMAT_B8G8R8A8_UNORM




Last edited May 22, 2013 at 9:08 AM by TypeOverride, version 10


No comments yet.