Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

exodus7

Objects within an array

This topic is 5562 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I want to put objects I''ve creating into an array. Can I do this? I seem to be having problems would it be better to put them in a structure? I’m using c++ thanks there is only one way

Share this post


Link to post
Share on other sites
Advertisement
I''ve got 9 objects of class CRect that hold the postions of 9 rectangles.

I want to put these into any array.

Example:
CRect rect1, rect2........

SetRect(rect1,topx,y,so on.......)

I''ve done this for all nine objects.

How do I know store that data in an array?


Share this post


Link to post
Share on other sites
Guest Anonymous Poster

SetRect(rect[0],x,y,so on....); //first rectangle

Will create a copy of rect[0] and pass that to the setRect function. when the function returns, rect[0] will be unchanged. you might want to pass rect[0] by reference. in this case calling

SetRect(rect,x,y,so on....); //first rectangle

will change the values in rect[0].

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!