[Fart-Annoyed] Can't Initialize a Brick!

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
BugSquisher
Posts: 5
Joined: April 19th, 2017, 11:27 pm

[Fart-Annoyed] Can't Initialize a Brick!

Post by BugSquisher » May 12th, 2017, 12:25 am

Hi, I just started on Fart-Annoyed and tried writing up my own code to make some of the basics of the game. I got my ball working fine, but when it comes to the brick I can't seem to get it initialized properly. For whatever reason, the rectangle I pass in to the constructor turns into uninitialized garbage and causes my brick to not be drawn.
Attachments
RectF.h
(510 Bytes) Downloaded 112 times
Brick.cpp
(199 Bytes) Downloaded 108 times
Brick.h
(371 Bytes) Downloaded 111 times

BugSquisher
Posts: 5
Joined: April 19th, 2017, 11:27 pm

Re: [Fart-Annoyed] Can't Initialize a Brick!

Post by BugSquisher » May 12th, 2017, 12:26 am

More files added.
Attachments
Game.cpp
(1.81 KiB) Downloaded 111 times
Game.h
(1.9 KiB) Downloaded 107 times
RectF.cpp
(987 Bytes) Downloaded 104 times

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

Re: [Fart-Annoyed] Can't Initialize a Brick!

Post by albinopapa » May 12th, 2017, 1:23 am

Same problem as the other two chaps

Code: Select all

RectF::RectF(const Vec2& top_left, const Vec2& bottom_right)
{
	RectF(top_left.x, bottom_right.x, top_left.y, bottom_right.y);
}

RectF::RectF(const Vec2& position, float width, float height)
{
	RectF(position.x, position.x + width, position.y, position.y + height);
}

RectF::RectF(const RectF& rect)
{
	RectF(rect.GetLeft(), rect.GetRight(), rect.GetTop(), rect.GetBottom());
}
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] Can't Initialize a Brick!

Post by albinopapa » May 12th, 2017, 1:24 am

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

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

Re: [Fart-Annoyed] Can't Initialize a Brick!

Post by chili » May 12th, 2017, 5:07 am

Yo bug, are you coming from a Java background?

I think I'll have to put a note about this on the tutorial wiki page.
Chili

BugSquisher
Posts: 5
Joined: April 19th, 2017, 11:27 pm

Re: [Fart-Annoyed] Can't Initialize a Brick!

Post by BugSquisher » May 13th, 2017, 12:03 am

No, I come from a no-programming background

Post Reply