Simple image problem

Just wondering how to swap an image on the screen. I am trying to swap images depending on user behavior so could potentially have a lot of images. It would be great if I could store image names in an array, I can figure that out, but having problems doing a basic switch between two images.

Do I copy a texture in to the image variable?

Thanks

M

hey,

im not really sure what you want to do and how familiar you are with c++ but the easiest way should be to use pointers and just switch them.

basis swap with ofImage pointers:

  
  
ofImage * imgPtrA, * imgPtrB, *temp;  
//load images like  
imgPtrA->loadImage("imageName.png");  
... etc  
//swap  
temp = imgPtrA;  
imgPtrA = imgPtrB;  
imgPtrB = temp;  
  

hope thats helps.

Thanks fx

I’m good with ActionScript 3.0 and new to C++ so trying to get my head around these things.

Just wondered what the * meant in front of those variables?

Also I see you have a new variable for each image. I could potentially have a large number, could I not just use an Array so it’s one reference instead of ten’s?

Many thanks