1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| void MyArea::Draw()
{
srand(time(NULL));
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(get_window());
Gdk::Color rouge("red");
Gdk::Color noir("yellow");
Gdk::Color bleu("blue");
get_default_colormap()->alloc_color(rouge);
get_default_colormap()->alloc_color(bleu);
get_default_colormap()->alloc_color(noir);
gc->set_foreground(rouge);
get_window()->clear();
if(!_mut->is_get() && !_mut->is_get2())
{
std::map<int,tache*> taches = commu->obtenir_copie_tache();
std::map<int,int> actions = commu->obtenir_copie_action();
std::map<int,tache*>::iterator iterateur;
for(iterateur=taches.begin();iterateur!=taches.end();iterateur++)
{
get_window()->draw_line(gc,iterateur->second->get_posx(),iterateur->second->get_posy()-5,iterateur->second->get_posx(),iterateur->second->get_posy()+5);
get_window()->draw_line(gc,iterateur->second->get_posx()-5,iterateur->second->get_posy(),iterateur->second->get_posx()+5,iterateur->second->get_posy());
}
float angle=64*360;
for(int i=1;i<=commu->get_nb_exploit();i++)
{
std::map<int,int>::iterator it;
it=actions.find(i);
if(it!=actions.end())
{
gc->set_foreground(noir);
std::map<int,tache*>::iterator ite_tache;
ite_tache=taches.find(it->second);
get_window()->draw_arc(gc,true,ite_tache->second->get_posx()+rand()%20-10,ite_tache->second->get_posy()+rand()%20-10,15,15,0,angle);
}
else
{
gc->set_foreground(bleu);
std::map<int,tache*>::iterator ite_action;
ite_action=taches.find(it->second);
get_window()->draw_arc(gc,true,20,20,15,15,0,angle);
}
}
}
} |
Partager