I'm studying C and know nothing about C++. LazyFoo's SDL2 tutorial that uses C++ does a thing with double colons that I don't understand and thus cannot follow in C.
If it helps, here's the link to the tutorial:
http://lazyfoo.net/tutorials/SDL/04_key_presses/index.php
SDL_Surface *loadSurface( std::string path )
{
//Load image at specified path
SDL_Surface *loadedSurface = SDL_LoadBMP( path.c_str());
if( loadedSurface == NULL )
{
printf("Unable to load image %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
}
return loadedSurface:
}
Everything here makes sense to me except the function parameters and LoadBMP parameters. I don't know what the ::
means, and I don't know what path.c_str()
is referring to.
Please, could someone explain it in a way that makes sense in C, or suggest a C-only workaround?