Jump to content
  • Advertisement
Sign in to follow this  
gabrielzheaven

SDL game

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

Advertisement
SDL_LoadBMP() does what the name implies, it loads a Windows or OS/2 Bitmap and returns a pointer to an SDL_Surface that contains the image data in a form usable by other SDL functions.
filename is an instance of the string class, c_str() is a method within the string class that return the contents of the string as a const char* which is required since SDL_LoadBMP will only except const char * as it's prototype is SDL_Surface *SDL_LoadBMP(const char *file);

DEV-C++ is horribly out of date and buggy I recommend you switch to the express edition of Microsoft's Visual C++ Or Code::Blocks.

Share this post


Link to post
Share on other sites
thanks for the reply..another doubt...what did u meant by c_str() is a method within the string class that return the contents of the string as a const char*..

SDL_LoadBMP() does what the name implies, it loads a Windows or OS/2 Bitmap and returns a pointer to an SDL_Surface that contains the image data in a form usable by other SDL functions.
filename is an instance of the string class, c_str() is a method within the string class that return the contents of the string as a const char* which is required since SDL_LoadBMP will only except const char * as it's prototype is SDL_Surface *SDL_LoadBMP(const char *file);

DEV-C++ is horribly out of date and buggy I recommend you switch to the express edition of Microsoft's Visual C++ Or Code::Blocks.

Share this post


Link to post
Share on other sites
Between this and your other thread it is clear that you do not yet understand the basics of C++. Delving into SDL at this point will likely be confusing and counter productive for you. I would advise you look into a good book on C++ and try get comfortable with the language itself. This generally involves writing lots of console programs to get used to the syntax and semantics of the language.

Share this post


Link to post
Share on other sites
.c_str() method just converts string to C-style char* because SDL was written in C and it can't apply C++ strings, so what's why you need to use c_str()

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!