Fart-Annoyed debugging help

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
100mph
Posts: 2
Joined: August 13th, 2020, 8:08 pm

Fart-Annoyed debugging help

Post by 100mph » August 13th, 2020, 8:23 pm

The ball.DoWallCollision function is causing putpixel to draw off the screen. I have narrowed it down somewhat with the debugger to the GetRect function, specifically where I am creating a RectF object. More specifically, it appears that there is a (maybe) problem with the vector math.
Attachments
fart-annoyed.zip
(97.02 KiB) Downloaded 190 times

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Fart-Annoyed debugging help

Post by albinopapa » August 13th, 2020, 9:34 pm

And calling a constructor from another constructor strikes again

Code: Select all

RectF::RectF(const Vec2& topLeft, const Vec2& bottomRight)
{
	RectF(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y);
}

RectF::RectF(const Vec2& topLeft, float width, float height)
{
	RectF(topLeft, topLeft + Vec2(width, height));
}
should be:

Code: Select all

RectF::RectF(const Vec2& topLeft, const Vec2& bottomRight)
	:
RectF(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y);
{
}

RectF::RectF(const Vec2& topLeft, float width, float height)
	:
RectF(topLeft, topLeft + Vec2(width, height));
{
	
}
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Fart-Annoyed debugging help

Post by albinopapa » August 13th, 2020, 9:38 pm

Don't feel bad, this has been one of the biggest issues amongst beginners here. I suppose it would be worth it to post a sticky about it.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

100mph
Posts: 2
Joined: August 13th, 2020, 8:08 pm

Re: Fart-Annoyed debugging help

Post by 100mph » August 13th, 2020, 9:45 pm

Thank you!

Post Reply