problems about Cimg
Oct 16, 2010 at 6:01am UTC
Below is my code
1 2 3 4 5 6 7 8 9 10 11
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
Oct 16, 2010 at 6:57am UTC
I solved the problem by myself
I should study the source code as well instead of just studying the reference
1 2 3 4 5 6 7 8 9 10
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
Topic archived. No new replies allowed.