Jump to content
  • Advertisement
Sign in to follow this  
Gamester3333

Pointer Declarations for Variable Bitmaps

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

Ok, I may sound like a noob, and I am... But I can't find this ANYWHERE! AND IT'S DRIVING ME CRAZY!!!! What would be the correct way to point to a bitmap, but allow the assignment to be changed??? I'm not very good at this, but all I need to finish this program is to know the proper re-assignable bitmap declarator that, for some reason, is nowhere to be found...

Share this post


Link to post
Share on other sites
Advertisement
You didnt specify what API you're using, so I'll just briefly explain.

You can use pointers:

yourBitmapType *pTheBitmap = new yourBitmapType;

delete pTheBitmap;

pTheBitmap = new yourBitmapType;

//or, you can set a pointer to an already set object
//if the other object is not a pointer:
pTheBitmap = &someOtherBitmap;
//or, if the other object is a bitmap
pTheBitmap = someOtherBitmap;




Note this is somewhat pseudocode, since you didnt mention a specific API...

For example, in SDL you can do something like this:

SDL_Surface *aBmp = IMG_Load("aBmp.bmp");

SDL_FreeSurface(aBmp);

aBmp = IMG_Load("anotherBmp.bmp");




This functions in SDL return a pointer, so you wouldnt need the new operator.

Just specify your API and we will be able to help more.

P.S. This is C++, so please specify your language, too.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!