Advertisement Jump to content
Sign in to follow this  
dbzprogrammer

Private Class Problem...(NOT SOLVED)

This topic is 4910 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, on the current game engine I'm working on, the render subsystem has a list of all objects to be rendered. This list is used to update objects, change them, transform/rotate/translate, and render them. Now this list is in the private section of the class. You can access it through the member functions. You can create a object and give the adress the the render system and it adds to the list and all that. But a couple of the functions need to return the object location, however since it's private I don't know if it can be accessed. Each component of the list is a structure, containing the Object, the name, the ID number, and a pointer to the next link. Any help/ideas? [Edited by - dbzprogrammer on August 10, 2005 11:30:30 AM]

Share this post


Link to post
Share on other sites
Advertisement
If i get you right then you want to return one of the structs contained in the list.

Assuming you know the index of an item in the list you can simply do:



myStruct myClass::GetFromList( unsigned int index )
{
return myList[ index ];
}





You can obviously identify an item in the list by what ever means you want but so long as you can identify the index of the item you can return it like so. You can return a list::iterator which will be a pointer to the node in the list.

Hope that helps.

ace

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!