Exemple #1
0
static int draw_boundaries(void)
{
    if (Rast_raster_cmp(bl, br, map_type) != 0)
	draw_bot();
    if (Rast_raster_cmp(tr, br, map_type) != 0)
	draw_rite();

    return 0;
}				/* draw_boundaries */
Exemple #2
0
void draw_bots(s_world *world)
{
  ASSERT(world != NULL);
  
  int b;
  for(b = 0; b < world->num_bots; ++b)
  {
    glPushMatrix();
    glTranslatef(world->bots[b].x, world->bots[b].y, 0.0);
    draw_bot(&world->bots[b]);
    glPopMatrix();
  }
}
Exemple #3
0
void draw_edge_bots(s_world *world)
{
  ASSERT(world != NULL);
  
  int b;
  for(b = 0; b < world->num_bots; ++b)
  {
    // Bottom of the world
    if(world->bots[b].y < 0.25*world->height)
    {
      glPushMatrix();
      glTranslatef(world->bots[b].x, world->bots[b].y+world->height, 0.0);
      draw_bot(&world->bots[b]);
      glPopMatrix();
      
      // Bottom left
      if(world->bots[b].x < 0.25*world->width)
      {
        glPushMatrix();
        glTranslatef(world->bots[b].x+world->width, world->bots[b].y+world->height, 0.0);
        draw_bot(&world->bots[b]);
        glPopMatrix();
      }
      // Bottom right
      else if(world->bots[b].x > 0.75*world->width)
      {
        glPushMatrix();
        glTranslatef(world->bots[b].x-world->width, world->bots[b].y+world->height, 0.0);
        draw_bot(&world->bots[b]);
        glPopMatrix();
      }
    }
    // Top of the world
    if(world->bots[b].y > 0.75*world->height)
    {
      glPushMatrix();
      glTranslatef(world->bots[b].x, world->bots[b].y-world->height, 0.0);
      draw_bot(&world->bots[b]);
      glPopMatrix();
      
      // Top left
      if(world->bots[b].x < 0.25*world->width)
      {
        glPushMatrix();
        glTranslatef(world->bots[b].x+world->width, world->bots[b].y-world->height, 0.0);
        draw_bot(&world->bots[b]);
        glPopMatrix();
      }
      // Top right
      else if(world->bots[b].x > 0.75*world->width)
      {
        glPushMatrix();
        glTranslatef(world->bots[b].x-world->width, world->bots[b].y-world->height, 0.0);
        draw_bot(&world->bots[b]);
        glPopMatrix();
      }
    }
    // Left of the world
    if(world->bots[b].x < 0.25*world->width)
    {
      glPushMatrix();
      glTranslatef(world->bots[b].x+world->width, world->bots[b].y, 0.0);
      draw_bot(&world->bots[b]);
      glPopMatrix();
    }
    // Right of the world
    if(world->bots[b].x > 0.75*world->width)
    {
      glPushMatrix();
      glTranslatef(world->bots[b].x-world->width, world->bots[b].y, 0.0);
      draw_bot(&world->bots[b]);
      glPopMatrix();
    }
  }
  
  // Cover the outsides
  // Left side
  glPushMatrix();
  glColor3f(0.0, 0.0, 0.0);
  glBegin(GL_QUADS);
    glVertex2f(-world->width, 0.0);
    glVertex2f(-world->width, world->height);
    glVertex2f(0.0, world->height);
    glVertex2f(0.0, 0.0);
  glEnd();
  glPopMatrix();
  // Right side
  glPushMatrix();
  glColor3f(0.0, 0.0, 0.0);
  glBegin(GL_QUADS);
    glVertex2f(world->width, 0.0);
    glVertex2f(world->width, world->height);
    glVertex2f(2*world->width, world->height);
    glVertex2f(2*world->width, 0.0);
  glEnd();
  glPopMatrix();
  // Top long side
  glPushMatrix();
  glColor3f(0.0, 0.0, 0.0);
  glBegin(GL_QUADS);
    glVertex2f(-world->width, world->height);
    glVertex2f(-world->width, 2*world->height);
    glVertex2f(2*world->width, 2*world->height);
    glVertex2f(2*world->width, world->height);
  glEnd();
  glPopMatrix();
  // Bottom long side
  glPushMatrix();
  glColor3f(0.0, 0.0, 0.0);
  glBegin(GL_QUADS);
    glVertex2f(-world->width, -world->height);
    glVertex2f(-world->width, 0.0);
    glVertex2f(2*world->width, 0.0);
    glVertex2f(2*world->width, -world->height);
  glEnd();
  glPopMatrix();
}