Table of Contents

 
PlaceText
 

Purpose

Moves the position of the text to a new specified location on the screen

 

Protoype

void CTextMngr::PlaceText (string str_text_id, int i_newx, int i_newy, exclude ex_list = exclude(), int i_flag = LIST_IN)
 

Parameters

text_id the ID of the text object to place, ALL_TEXTS if placing more than one object
newx the new X position
newy the new 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 places text objects at the coordinates given. So if a text object is located at (100, 200) and you pass in i_newx and i_newy values of 50 and 50, the new location of the text object will be (50, 50). If you want relative movement, then use MoveText().

Placing Multiple Objects

If you want to place more than one text object at once at the same location, 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 place all text objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to place 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;
// place one text object
text.PlaceText("my_text", 50, 50);
// place ALL text objects except "my_text"
exclude ex_list;
ex_list.push_back("my_text");
text.PlaceText(ALL_TEXTS, 50, 50, ex_list, LIST_IN);
// place 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.PlaceText(ALL_TEXTS, 50, 50, ex_list, LIST_OUT);
 

Prev: MoveText