SDL - Confused with class pointers

Started by
1 comment, last by KenWill 8 years, 4 months ago

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... :\

Advertisement

SDL_CreateWindow is a function, not a class. It returns a SDL_Window*.

SDL_CreateWindow is a function, not a class. It returns a SDL_Window*.

Oh, that makes more sense now. I'm sorry for my dumb question but i just didn't think about that.

This topic is closed to new replies.

Advertisement