Esempio n. 1
0
/*
 * Position the notification relative to the block it is
 * talking about.
 */
void GameController::HandleNotificationUpdateCallback(void *handler, void *notification)
{
    hdVec2 screenPos;
    hdVec2 aa,bb;

    /* Volatile - both the notification and handler may go away at any time */
    if (handler == NULL || notification == NULL) return;

    GameController *self = (GameController *)handler;
    Polygon* note = (Polygon *)notification;
    Block* block = (Block *)note->GetRelative();

    if (NULL == note->GetWorld()) return;

    if (block != NULL)
    {
        self->ConvertInterfaceToScreen(screenPos, block->GetWorldCenter().x, block->GetWorldCenter().y);
        aa.Set(screenPos.x - 35.0f, screenPos.y + 30.0f);
        bb.Set(aa.x + 70, aa.y + 35);

        note->RemoveAllPoints();
        note->AddPoint(aa.x, aa.y);
        note->AddPoint(aa.x, bb.y);
        note->AddPoint(bb.x, bb.y);
        note->AddPoint(bb.x, aa.y);
    }
}
Esempio n. 2
0
shared_ptr<Hull>
CreateHull()
{
  shared_ptr<Hull> hull(new Hull());
  static const double octoSmall = 0.178;
  static const double octoBig = 0.430;
  
  Polygon outline;		// temporary
  outline.AddPoint( octoBig  , octoSmall);
  outline.AddPoint( octoSmall, octoBig);
  outline.AddPoint(-octoSmall, octoBig);
  outline.AddPoint(-octoBig  , octoSmall);
  outline.AddPoint(-octoBig  ,-octoSmall);
  outline.AddPoint(-octoSmall,-octoBig);
  outline.AddPoint( octoSmall,-octoBig);
  outline.AddPoint( octoBig  ,-octoSmall);
  hull->AddPolygon(outline);
  
  return hull;
}