Exemplo n.º 1
0
Arquivo: main.c Projeto: Wobow/Tek1
void		go_exec(t_info *s, t_prog *lp, int (**tab_fct)())
{
  t_prog	*cur;
  int		temp;

  cur = lp;
  while (cur != NULL)
    {
      if (cur->exec < 1 || cur->exec > 16 || cur->np == 0)
	{
	  cur->pc = (cur->pc + 1) % MEM_SIZE;
	  redf(cur, s);
	}
      else if (cur->ncycle == s->cycle)
	{
	  tab_fct[cur->exec - 1](s, cur);
	  if ((temp = cur->exec) != 9)
	    cur->pc = (cur->pc + cur->lenp) % MEM_SIZE;
	  redf(cur, s);
	}
      cur = cur->next;
    }
}
Exemplo n.º 2
0
void CGColor::getHSV(float &h, float &s, float &v) const
{
    // see https://de.wikipedia.org/wiki/HSV-Farbraum
    float rr=redf();
    float gg=greenf();
    float bb=bluef();
    float ma=std::max(std::max(rr,gg),bb);
    float mi=std::min(std::min(rr,gg),bb);

    if (ma==mi) h=0;
    else if (ma==rr) h=60.0*(0.0+(gg-bb)/(ma-mi));
    else if (ma==gg) h=60.0*(2.0+(bb-rr)/(ma-mi));
    else if (ma==bb) h=60.0*(4.0+(rr-gg)/(ma-mi));
    if (h<0.0) h=h+360.0;

    if (ma==0.0) s=0.0;
    else s=(ma-mi)/ma;

    v=ma;
}