Table of Contents

 
MoveText
 

Purpose

Moves the position of the text or texts to a new specified location on the screen relative to its current location

 

Protoype

void CTextMngr::MoveText (string str_text_id, int i_dx, int i_dy, exclude ex_list = exclude(), int i_flag = LIST_IN)
 

Parameters

text_id

the ID of the text to move, ALL_TEXTS if moving more than one text object

dx the change in X position
dy the change in Y position
list the list of text 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 text relative from its current position. So if a text object is at (100, 200) and you pass in i_dx and i_dy values of 20 and 40, the new location of the text object will be (120, 240). This function is good for updating the movement of text. For absolute positioning you should use PlaceText().

Moving Multiple Objects

If you want to move more than one text 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 text 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_TEXTS for str_text_id.

 

Use

CTextMngr text;
// move one text object
text.MoveText("my_text", 5, 5);
// move ALL text objects except "my_text"
exclude ex_list;
ex_list.push_back("my_text");
text.MoveText(ALL_TEXTS, 5, 5, ex_list, LIST_IN);
// move ONLY these three text objects
exclude ex_list;
ex_list.push_back("my_text1");
ex_list.push_back("my_text2");
ex_list.push_back("my_text3");
text.MoveText(ALL_TEXTS, 5, 5, ex_list, LIST_OUT);
 

Prev: LoadTexts
Next: PlaceText