Пример #1
0
bool inbounds(point* pos, world* game_world) {
  return pos->x >= 0 && pos->x < game_world->width &&
         pos->y >= 0 && pos->y < game_world->height &&
         !contains_point(pos->x, pos->y, game_world->game_player->tail,
                         game_world->game_player->tail_length) &&
         !contains_point(pos->x, pos->y, game_world->walls, game_world->num_walls);
}
Пример #2
0
void cube::draw(const vect3f* const pointer_pos) const {
  bool restore_solid = _solid;

  bool highlight = false;
  if (pointer_pos != 0) highlight = true;

  glColor3f(_color.x, _color.y, _color.z);

  if (highlight) {
    if (contains_point(*pointer_pos)) {
      glColor3f(_highlight_color.x, _highlight_color.y, _highlight_color.z);
      _set_solid();
    }
  }

  glPushMatrix();
  _front.draw();
  _right.draw();
  _back.draw();
  _left.draw();
  _top.draw();
  _bottom.draw();
  glPopMatrix();

  _set_solid(restore_solid);
}
bool DisplayChannel::pointer_test(int x, int y)
{
    return contains_point(x, y);
}