Hello Chillie

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
coolhenrik10
Posts: 4
Joined: May 19th, 2012, 4:37 pm

Hello Chillie

Post by coolhenrik10 » May 19th, 2012, 4:49 pm

I have a problem, i was watching you're videos (Beginner C++ DirectX Game Programming Tutorial: Lesson 4) and an error came up i am sending the program so you can tell me whats wrong.

sincerely Henrik

(sorry for my bad English but I am 14 and live in Denmark :) )

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Hello Chillie

Post by chili » May 19th, 2012, 5:07 pm

Okay bro, sure. Just post your code and I'll have a look.
Chili

coolhenrik10
Posts: 4
Joined: May 19th, 2012, 4:37 pm

Re: Hello Chillie

Post by coolhenrik10 » May 19th, 2012, 6:38 pm

Here it is:
{
int x;
int y;
x=0;
y=0;

gfx.PutPixel( x, y,255,255,255);
gfx.PutPixel( -5 + x, y,255,255,255);
gfx.PutPixel( -4 + x, y,255,255,255);
gfx.PutPixel( -3 + x, y,255,255,255);
gfx.PutPixel( 3 + x, y,255,255,255);
gfx.PutPixel( 4 + x, y,255,255,255);
gfx.PutPixel( 5 + x, y,255,255,255);
gfx.PutPixel( x, -5 + y,255,255,255);
gfx.PutPixel( x, -4 + y,255,255,255);
gfx.PutPixel( x, -3 + y,255,255,255);
gfx.PutPixel( x, 3 + y,255,255,255);
gfx.PutPixel( x, 4 + y,255,255,255);
gfx.PutPixel( x, 5 + y,255,255,255);
}

coolhenrik10
Posts: 4
Joined: May 19th, 2012, 4:37 pm

Re: Hello Chillie

Post by coolhenrik10 » May 19th, 2012, 6:49 pm

But it say hvem i start the program:
Assertion failed!

program:...
File c:\user\henrik\desktop\c++programming (thats what my folder)\d3dgraphics.cpp
line: 71

Expression

For information on how your program can cause an assertion failure, see the C++ documentation on asserts

(Press retry to debug the application - JIT must be enabled)

User avatar
accucore12
Posts: 14
Joined: May 18th, 2012, 1:06 pm

Re: Hello Chillie

Post by accucore12 » May 19th, 2012, 8:14 pm

Hi. It has got to do with the parameters passed to PutPixel function
For instance in this line of your code,

gfx.PutPixel( -5 + x, y,255,255,255);

Notice that when x is 0.
-5 + x evaluates to negative 5 which does not fall within 0 to 800.
So It terminates with an error since there is no location on your screen that has coordinate of -5.

One thing to keep in mind when following the tutorial is that the X values has to be within 0 to 800
Y value has to be within 0 to 600.


An example of fixing this would be the below(make sure you understand the underlying reason is that i am trying to remove any occurence of negative coordinate)
instead of
x=0;
y=0;
replace it with
x=100;
y=100;

I hope this would be of help to you.

Code: Select all

Occupation: Reverse Engineer
[/color]

coolhenrik10
Posts: 4
Joined: May 19th, 2012, 4:37 pm

Re: Hello Chillie

Post by coolhenrik10 » May 19th, 2012, 8:47 pm

Dude you're fu****g awesome thanks :)

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Hello Chillie

Post by chili » May 20th, 2012, 2:24 am

coolhenrik10 wrote:Dude you're fu****g awesome thanks :)
I second that emotion. 8-)
Chili

Post Reply