Sign in to follow this  

Pointer Declarations for Variable Bitmaps

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

This topic is 4418 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this