Page 1 of 2

HELP WITH LESSON 12!!

Posted: June 9th, 2012, 1:32 pm
by chilipotatoe
Hi guys. This is my first post.

okay umm.... I'm on lesson 12 ( tic tac toe game). And I'm typing everything right. I quadrouple check. But when i try to draw the grid, and the circle and the x. some of the lines are missing. I posted a screen shot so you guys can see.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 1:35 pm
by LuX
Well...?
Upload some code so we can help.

And do read this: http://www.planetchili.net/forum/viewtopic.php?f=3&t=2

By a fraction of a second, chili, by a fraction.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 1:35 pm
by chili
Don't see any screenshot bro. Anyways, screenshots interest me not. Read the forum rules and then post your zipped cleaned solution.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 1:51 pm
by chilipotatoe
Sorry. I dont know why the screenshot wasn't working before, but now it should. And I added my code. I'm still getting used to the site.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 2:34 pm
by LuX
Took some time since I was making food. But your code in Game.cpp is a'ok : -)

But then...

...What the fuck is going on in D3DGraphics?!

Looks really weird in there and I wasn't even able to run it properly. Or maybe it's the ghillie version of the framework? Anyways. Go through the beginning of the D3DGraphics.cpp and .h again. The problem lies somewhere there.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 2:55 pm
by chilipotatoe
I have a modified version that chili made, because my computer sucks. So maybe thats why its weird? idk
i'm actually new to this programming thing, and i dont really know much.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 3:00 pm
by LuX
Alright, well I see where your problem is now. This one has happened to someone before, but look at your draw line function in D3D.

Code: Select all

float m = (float)dx / (float)dy; 
		float b = x1 - m * y1;                 //<--------- "b" defined as line equation
		for ( int y = y1; y <= y2; y++ )
	   {
		  int x = m*y + b + 0.5f;
		  PutPixel ( x,y,r,g,b );                //<---------- "b" is not blue in this case!
	   }
Notice how you use variable "b" for two purposes. What you need to do is rename either one.

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 3:52 pm
by chilipotatoe
Now i get this; error C2065: 'blue' : undeclared identifier

all i did was change the b in putpixel to blue in the d3d.h and the d3d.cpp

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 4:23 pm
by LuX
Without seeing where and what you changed exactly its hard to say where the error is, but basically the computer doesn't know what "blue" is unless you tell it by writing something like "int blue"

Re: HELP WITH LESSON 12!!

Posted: June 9th, 2012, 4:33 pm
by chilipotatoe
umm could you please tell me how to change a variable then? because i dont think i fully understand. sorry for being such a noob