Beginner's C++ Tutorial Lesson 8 problem in D3DGraphics.cpp

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
TadZah
Posts: 2
Joined: March 11th, 2013, 7:01 am

Beginner's C++ Tutorial Lesson 8 problem in D3DGraphics.cpp

Post by TadZah » March 11th, 2013, 7:27 am

Greetings.

I've been having a minor problem which prevents me from starting
my project. It builds just fine but I am not able to start it up.
In debug mode it points to D3DGraphics.cpp and from there it points
this particular line:

"((D3DCOLOR*)rect.pBits)[ x + (rect.Pitch >> 2) * y ] = D3DCOLOR_XRGB( r,g,b );"

I have absolutely no idea what is wrong with it. I haven't even touched
D3DGraphics.cpp. This is possibly just an very stupid human error but
I have no idea what I did wrong.

Edit: I changed it back to normal crosshair. It worked fine with that.
It seems that for some reason the more complicated pixel art
does not work.

System information:

Visual C++ 2010
Windows 8 64-bit
DirectX SDK (June 2010)
Lesson 1 version of Chili DirectX Framework

i7-3630QM
16gb RAM
GTX 660M
Attachments
Chili DirectX Framework.zip
(35.53 KiB) Downloaded 148 times

User avatar
Nosferatu
Posts: 36
Joined: July 25th, 2012, 7:08 am
Location: Slovakia

Re: Beginner's C++ Tutorial Lesson 8 problem in D3DGraphics.

Post by Nosferatu » March 11th, 2013, 1:40 pm

I've tried your program and it works fine for me. The only thing I see is wrong, is your sprite clamping. It should be more like this :

Code: Select all

if( faceX < 0 )
	{
		faceX = 0;
	}

	if( faceX > 779 )
	{
		faceX = 779;
	}

	if( faceY < 0 )
	{
		faceY = 0;
	}
	
	if( faceY > 579 )
	{
		faceY = 579;
	}
It is possible it gives you the error because of drawing off-screen.

User avatar
TadZah
Posts: 2
Joined: March 11th, 2013, 7:01 am

Re: Beginner's C++ Tutorial Lesson 8 problem in D3DGraphics.

Post by TadZah » March 12th, 2013, 7:32 am

Thank you kindly.

That fix worked.

Post Reply