Jump to content
  • Advertisement
Sign in to follow this  
Vectormycalculus

declaring skybox

This topic is 3877 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

how do i declare m_skybox.Initialize(); in the header file? it wont let me have '.' tokens and wants a primary expression before them in the .cpp file so i made a new class for skybox class m_skybox { should i have 'public:' here? or private? m_skybox(); ~m_skybox(); // now i want to declare .Initialize() so.. m_skybox.Initialize(); // but that doesnt work. by having this class it declares the skybox but i do not know how to have .Initailize(); in the header without need primary expressions before the '.' token in the .cpp file.

Share this post


Link to post
Share on other sites
Advertisement
First off, your expression for the Initialize() method is trying to make a call to that method within the class definition when you are wanting to define it. While I disagree with your naming conventions and the whole bit, I have reworked this below as a full class definition and followed it up with the code to implement the Initialize method.


class m_skybox
{
// Que 1: Should I have 'public' here or 'private'
// Ans 1: As you only have one constructor this should be public
public:

m_skybox();
virtual ~m_skybox();

// now i want to declare .Initialize() so..
void Initialize( void );
};

//Now if you want to actually implement the Initialize function...
// (notice it is outside the class declaration)
void m_skybox::Initialize( void )
{
}

// and after you have created an object of type m_skybox you call it this
// way for a declaration on the stack (ex. within your main)
m_skybox variableName;
variableName.Initialize();





Ok, with that out of the way I HIGHLY recommend you review online articles or purchase a book on C++ development particularly as it pretains to object oriented programming as I can see by your questions and implementation that you do not fully understand how to declare, implement and use the class you are attempting to write. You could just copy/paste this code into your application and it would work as-is but without understanding of object-oriented programming as a whole this really won't make a whole lot of sense.

Best of luck!

Share this post


Link to post
Share on other sites
i also included int main() before m_skybox variableName; so that varaibleName.Initialize works without error in the header file.

but it just takes me back to needing a primary expression in the .cpp file.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!