0

Below is my code

void specificity::showText(vector<name_ID> &sacrifice, int die)
{         
  cimg::wait(100);   
  unsigned int R = 50 + rand() % 255;
  unsigned int G = 100 + rand() % 255;
  unsigned int B = 50 + rand() % 255;
 
  unsigned char purple[] = { R,G,B };  
  img.fill(0).draw_text(width / 2, height / 2, sacrifice[die].first.c_str(), purple);  
  img.display();           
}

I have to press the keyboard or mouse to reactivate the img.display()
How could I make it reactivate automatically?
Besides, how could I change the size of text?
Thanks a lot

1
Contributor
1
Reply
3
Views
6 Years
Discussion Span
Last Post by stereomatching
0

I solved the problem by myself
I should study the source code as well instead of just studying the reference

void specificity::showText(vector<name_ID> &sacrifice, int die)
{       
  
  cimg::wait(400);
    
  const float white[] = { 255, 255, 255 }, black[] = { 255, 0, 0 }; 
  img.draw_text(width / 2, height / 2, "%s", white, black, 0.5f, 28, sacrifice[die].first.c_str() );
  disp.display(img);

}

thanks a lot

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.