Yes, it sounds like you are describing the concepts correctly.
The declaration of the OnLoad() method says that it returns to pointer to an SDL_Surface and takes a pointer to a char as an argument. Something to note is that a char* represents a C-style string; it points to the first of many characters of a string. You should really think of it not as a pointer, but just a normal string/text in this context.
Just from looking at the class declaration, I would imagine (and it seems to be the case) the the OnLoad() function takes a C-string representing a file name and uses that to load up a surface and returns a pointer to that surface.
On line 5 of the method I would imagine SDL_LoadBMP() is loading a bitmap file specified by the filename given (this is the C-string "File"). That function returns a pointer to the surface that represents that just-loaded bitmap. That pointer is assigned to assigned to Surf_Temp so we can use it later.
The next part of the if statement condition checks if the surface pointer we have is NULL. I would imagine this is in the case of an error - e.g. the file didn't exist, there was a problem loading the bitmap, etc.
Line 9 seems to take the Surf_Temp we just loaded up and format it in some way (I'm not familiar with SDL at all so I couldn't tell you the specifics), returning a new pointer to this formatted surface. This, I would guess, is the final result surface we were looking for, so we put it in Surf_Return.
Finally, we call a function to free the temporary surface (the one we loaded into Surf_Temp and now now longer need as we have a formatted version) memory before returning the pointer to the formatted surface.
I hope this kind of explanation is helpful.
Now to your actual comments (some were answered above).
| As you can see from my OP, the initial declaration of the function in CSurface.h included two pointers: OnLoad, pointing back to SDL_Surface and File, which I presume is the returned pointer? |
I don't think this understanding is exactly right. See my description of the function definition above; OnLoad() takes a pointer to a char as a parameter and returns a pointer to an SDL_Surace.
| In CSurface.cpp, we call the pointer function OnLoad |
We are not calling anything in CSurface.cpp. This is just the function implementation. A call would probably look like this:
SDL_Surface* somefile_surface = CSurace::OnLoad("somefile.bmp");
[quote(although it's confusing that they also include the class CSurface after the pointer declaration of the typedef struct SDL_Surface... maybe there's a nuance there I'm not understanding also?).[/quote]
What do you mean? I don't understand what you're saying about "including the class CSurface" as there are no #include statements and I don't see the typedef to which you are referring.
[quote]After the function itself finishes and it returns Surf_Return, what is it actually returning? And to where?[/quote]
It is returning the pointer to the formatted surface we loaded from the file given as a parameter. See my description of the implementation above. And it returns to whatever has called it; note again what I said above: this code is the implementation of the function, not a call.