^From Game.cpp in the game class
After doing the changes to putpixel in lesson 13, it won't work anymore and is underlined in red.
Code: Select all
/******************************************************************************************
******************************************************************************************/
#include "D3DGraphics.h"
D3DGraphics::D3DGraphics( HWND hWnd )
{
backRect.pBits = NULL;
pDirect3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp,sizeof( d3dpp ) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
d3dpp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
pDirect3D->CreateDevice( D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE,&d3dpp,&pDevice );
pDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO,&pBackBuffer );
}
D3DGraphics::~D3DGraphics()
{
if( pDevice )
{
pDevice->Release();
pDevice = NULL;
}
if( pDirect3D )
{
pDirect3D->Release();
pDirect3D = NULL;
}
if( pBackBuffer )
{
pBackBuffer->Release();
pBackBuffer = NULL;
}
}
void D3DGraphics::PutPixel( int x,int y,int r,int g,int b )
{
((D3DCOLOR*)backRect.pBits)[ x + (backRect.Pitch >> 2) * y ] = D3DCOLOR_XRGB( r,g,b );
}
void D3DGraphics::BeginFrame()
{
pDevice->Clear( 0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),0.0f,0 );
pBackBuffer->LockRect( &backRect, NULL,NULL);
}
void D3DGraphics::EndFrame()
{
pBackBuffer->UnlockRect();
pDevice->Present( NULL,NULL,NULL,NULL );
}
Code: Select all
1>------ Build started: Project: Chili DirectX Framework, Configuration: Debug Win32 ------
1>Build started 4/20/2012 8:13:47 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Chili DirectX Framework.unsuccessfulbuild".
1>ClCompile:
1> Game.cpp
1>c:\users\kyle pence\documents\visual studio 2010\projects\chili directx framework\assets\game.cpp(67): error C3861: 'PutPixel': identifier not found
1>c:\users\kyle pence\documents\visual studio 2010\projects\chili directx framework\assets\game.cpp(93): warning C4244: 'initializing' : conversion from 'float' to 'int', possible loss of data
1>c:\users\kyle pence\documents\visual studio 2010\projects\chili directx framework\assets\game.cpp(94): error C3861: 'PutPixel': identifier not found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.52
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========