Jump to content
  • Advertisement
Sign in to follow this  
KenWill

SDL - Confused with class pointers

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

Hi

 

I tried SDL for the first time and in their documentation i found something i do not understand.

They make a pointer to the "SDL_Window" class called "window" and make the pointer null then later on they do this

window = SDL_CreateWindow( "SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );

Now i don't understand how this works because "SDL_CreateWindow" seems to be a totally different class. Shouldn't the pointer point to the same type? In this case, a "SDL_Window" object.

Does this work because "SDL_CreateWindow" is a child of "SDL_Window"?

 

EDIT:

Ok, i am totally confused right now. I just tried and i can't seem to do the same with a class created by me and that is just trying to do this

classOne* aClass = NULL;
aClass = classOne(23,14);

I also just realized that you should pass the address to the pointer but they don't do that...

How does this work? Its "SDL_CreateWindow" a function? I am so lost... :\

Edited by UAas

Share this post


Link to post
Share on other sites
Advertisement
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!