Help for a newbie?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
CMH21CMH
Posts: 4
Joined: July 29th, 2012, 1:20 pm

Help for a newbie?

Post by CMH21CMH » July 29th, 2012, 1:25 pm

So I'm on Lesson 4 of Chillis' amazing tutorials but for some reason a error message keeps appearing for the following code;

int x;
int y;
x = -400;
y = -400;

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 );

I've just started C++, any help for a Newbie please? :)
-Thankyou

BrokenBackspaceKey
Posts: 9
Joined: July 29th, 2012, 3:09 pm

Re: Help for a newbie?

Post by BrokenBackspaceKey » July 29th, 2012, 3:43 pm

x and y should be 400, and not negative 400.

good luck

- Backspace

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Help for a newbie?

Post by LuX » July 29th, 2012, 4:28 pm

Broken is right, to add a little explanation, this happens because you are accessing memory outside the buffer, that doesn't exist.

The screen memory you have ranges from 0 to 480 000 (if your screen resolution is 800x600) so anything outside that will cause an error. In this case you are going out on the negative side. The pixels you are "allowed" to use are x: 0-799, y: 0-599.

If you run the program through "release" you may not get the error if you leave through the sides (since leaving only little from the sides, will have a chance to still be inside the memory boundary), but leaving from the top or bottom or going too far on the sides will definitely be outside the boundary.
ʕ •ᴥ•ʔ

CMH21CMH
Posts: 4
Joined: July 29th, 2012, 1:20 pm

Re: Help for a newbie?

Post by CMH21CMH » July 29th, 2012, 9:34 pm

Thanks guys but there was still an error :(
The output is;

1>C:\Users\C\Documents\C++\Chili DirectX Framework\Chili DirectX Framework\Chili DirectX Framework.vcxproj : error MSB4014: at Microsoft.Build.Execution.BuildManager.IssueRequestToScheduler(BuildSubmission submission, Boolean allowMainThreadBuild, BuildRequestBlocker blocker)

BrokenBackspaceKey
Posts: 9
Joined: July 29th, 2012, 3:09 pm

Re: Help for a newbie?

Post by BrokenBackspaceKey » July 31st, 2012, 12:44 am

According to my research on the subject, there is a hotfix patch that you can download from Microsoft at-->

http://social.msdn.microsoft.com/Forums ... 8874c75397



Also, there is a note at -->

http://connect.microsoft.com/VisualStud ... -c-project

that seems to indicate that an antivirus could be the culprit. They mention Avast by name, but I actually have Avast installed, and I don't have any problems (yet).

<-- Backspace

CMH21CMH
Posts: 4
Joined: July 29th, 2012, 1:20 pm

Re: Help for a newbie?

Post by CMH21CMH » July 31st, 2012, 11:55 am

Thankyou but i copied my code and reinstalled the framework so i think i managed to delete something

Post Reply