コード例 #1
0
ファイル: rock.cpp プロジェクト: kthxbyte/KDE1-Linaro
static void
rock_tick ( Window win, arock *arocks, int d)
{
  rockstruct *rp = &rocks[screen];

  if (arocks->depth > 0) {
    rock_draw(win, arocks, False);
    arocks->depth -= rp->speed;
    if (rp->rotate_p)
      arocks->theta = (arocks->theta + d) % RESOLUTION;
    while (arocks->theta < 0)
      arocks->theta += RESOLUTION;
      if (arocks->depth < (MIN_DEPTH * DEPTH_SCALE))
	arocks->depth = 0;
      else {
	rock_compute(arocks);
	rock_draw(win, arocks, True);
      }
  } else if ((LRAND() % 40) == 0)
    rock_reset(win, arocks);
}
コード例 #2
0
ファイル: rocks.c プロジェクト: BuBuaBu/bang-screensaver
static void
rock_tick (struct state *st, struct rock *rock, int d)
{
  if (rock->depth > 0)
    {
      rock_draw (st, rock, False);
      rock->depth -= st->speed;
      if (st->rotate_p)
        {
	  rock->theta = (rock->theta + d) % SIN_RESOLUTION;
        }
      while (rock->theta < 0)
	rock->theta += SIN_RESOLUTION;
      if (rock->depth < (MIN_DEPTH * DEPTH_SCALE))
	rock->depth = 0;
      else
	{
	  rock_compute (st, rock);
	  rock_draw (st, rock, True);
	}
    }
  else if ((random () % 40) == 0)
    rock_reset (st, rock);
}