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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.