Page 1 of 1

Fart-Annoyed debugging help

Posted: August 13th, 2020, 8:23 pm
by 100mph
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.

Re: Fart-Annoyed debugging help

Posted: August 13th, 2020, 9:34 pm
by albinopapa
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));
{
	
}

Re: Fart-Annoyed debugging help

Posted: August 13th, 2020, 9:38 pm
by albinopapa
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.

Re: Fart-Annoyed debugging help

Posted: August 13th, 2020, 9:45 pm
by 100mph
Thank you!