Table of Contents

 
MoveImage
 

Purpose

Moves an image or many images to a new location relative to its current position

 

Protoype

void CImageMngr::MoveImage (int i_dx, int i_dy, string str_img_id, exclude ex_list = exclude(), int i_flag = LIST_IN)
 

Parameters

dx the change in X position
dy the change in Y position
img_id the ID of the image to move, ALL_IMAGES if moving more than one image object
list the list of image objects to exclude or include in function
flag whether to exclude objects not in the list (LIST_OUT) or objects in the list (LIST_IN)
 

Description

This function moves images relative from their current position. So if an image object is at (100, 200) and you pass in i_xchange and i_ychange values of 20 and 40, the new location of the image object will be (120, 240).

Moving Multiple Objects

If you want to move more than one image object at once the same distance, then you can use the last two parameters of the function. First you must compile a list (an STL vector) of objects that you want to either exclude or include. If you want to move all image objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to move only a certain set of objects, pass those in for ex_list along with the flag LIST_OUT. You should also pass ALL_IMAGES for str_image_id.

 

Use

CImageMngr image;
// move one image object
image.MoveImage(5, 5, "my_image");
// move ALL image objects except "my_image"
exclude ex_list;
ex_list.push_back("my_image");
image.MoveImage(5, 5, ALL_IMAGES, ex_list, LIST_IN);
// move ONLY these three image objects
exclude ex_list;
ex_list.push_back("my_image1");
ex_list.push_back("my_image2");
ex_list.push_back("my_image3");
image.MoveImage(5, 5, ALL_IMAGES, ex_list, LIST_OUT);
 

Prev: LoadImages