void PanGestureDetector::AddDirection( Radian direction, Radian threshold )
{
  AddAngle( direction, threshold );

  // Calculate the opposite angle so that we cover the entire direction.
  direction = GetOppositeAngle( direction );

  AddAngle( direction, threshold );
}
Example #2
0
/** Update this game object by updating position, velocity and angle of object. */
void GameObject::Update(int t)
{
	// Calculate seconds since last update
	float dt = t / 1000.0f;
	// Update angle
	AddAngle(mRotation * dt);
	// Update position
	AddPosition(mVelocity * dt);
	// Update velocity
	AddVelocity(mAcceleration * dt);
	// Update sprite if one exists
	if (mSprite.GetPtr() != NULL) mSprite->Update(t);
	// If in world, wrap position const int zl = mGameWindow->GetZoomLevel();
	if (mWorld) { mWorld->WrapXY(mPosition.x, mPosition.y); }
}
Example #3
0
void
SectorZoneEditWidget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  ObservationZoneEditWidget::Prepare(parent, rc);

  const auto shape = GetObject().GetShape();

  AddFloat(_("Radius"), _("Radius of the OZ sector."),
           _T("%.1f %s"), _T("%.1f"),
           0.1, 200, 1, true,
           UnitGroup::DISTANCE, GetObject().GetRadius(),
           this);

  if (shape == ObservationZone::Shape::SYMMETRIC_QUADRANT) {
    AddDummy();
    AddDummy();
  } else {
    AddAngle(_("Start radial"), _("Start radial of the OZ area"),
             GetObject().GetStartRadial(), 10, true,
             this);

    AddAngle(_("Finish radial"), _("Finish radial of the OZ area"),
             GetObject().GetEndRadial(), 10, true,
             this);
  }

  if (shape == ObservationZonePoint::Shape::ANNULAR_SECTOR) {
    const AnnularSectorZone &annulus = (const AnnularSectorZone &)GetObject();

    AddFloat(_("Inner radius"), _("Inner radius of the OZ sector."),
             _T("%.1f %s"), _T("%.1f"),
             0.1, 100, 1, true,
             UnitGroup::DISTANCE, annulus.GetInnerRadius(),
             this);
  }
}
Example #4
0
void
WindSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
  RowFormWidget::Prepare(parent, rc);

  const WindSettings &settings = CommonInterface::GetComputerSettings().wind;
  const MapSettings &map_settings = CommonInterface::GetMapSettings();

  static constexpr StaticEnumChoice auto_wind_list[] = {
    { AUTOWIND_NONE, N_("Manual"),
      N_("When the algorithm is switched off, the pilot is responsible for setting the wind estimate.") },
    { AUTOWIND_CIRCLING, N_("Circling"),
      N_("Requires only a GPS source.") },
    { AUTOWIND_ZIGZAG, N_("ZigZag"),
      N_("Requires GPS and an intelligent vario with airspeed output.") },
    { AUTOWIND_CIRCLING | AUTOWIND_ZIGZAG, N_("Both"),
      N_("Use ZigZag and circling.") },
    { 0 }
  };

  AddEnum(_("Auto wind"),
          _("This allows switching on or off the automatic wind algorithm."),
          auto_wind_list, settings.GetLegacyAutoWindMode());

  if (edit_trail_drift)
    AddBoolean(_("Trail drift"),
               _("Determines whether the snail trail is drifted with the wind "
                 "when displayed in circling mode. Switched Off, "
                 "the snail trail stays uncompensated for wind drift."),
               map_settings.trail.wind_drift_enabled);
  else
    AddDummy();

  if (edit_manual_wind) {
    SpeedVector manual_wind = CommonInterface::Calculated().GetWindOrZero();

    AddReadOnly(_("Source"));

    WndProperty *wp =
      AddFloat(_("Speed"), _("Manual adjustment of wind speed."),
               _T("%.0f %s"), _T("%.0f"),
               fixed(0),
               Units::ToUserWindSpeed(Units::ToSysUnit(fixed(200),
                                                       Unit::KILOMETER_PER_HOUR)),
               fixed(1), false,
               Units::ToUserWindSpeed(manual_wind.norm),
               this);
    DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField();
    df.SetUnits(Units::GetWindSpeedName());
    wp->RefreshDisplay();

    wp = AddAngle(_("Direction"), _("Manual adjustment of wind direction."),
                  manual_wind.bearing, 5u, false,
                  this);

    manual_modified = false;
  }

  if (clear_manual_button)
    AddButton(_("Clear"), *this, CLEAR_MANUAL);

  UpdateVector();
}
Example #5
0
void AnimatorBar::OnRClickAnimation(NMHDR *pNMHDR, LRESULT *pResult)
{
	if (application == NULL)
		return;

	CPoint Pt;
	GetCursorPos(&Pt);
	animations.ScreenToClient(&Pt);
	if (animations.HitTest(Pt))
		animations.SelectItem(animations.HitTest(Pt));

	curHTreeItem = animations.GetSelectedItem();

	if(animations.GetCount() == 0)
		return; //Theres no animations in this tree, so the object doesn't have animations

	// Check for this
	if (!animations.HitTest(Pt))
	{
		curHTreeItem = TVI_ROOT;
		m_pCurrentAnimation = m_pAnimation;
	}

	else
		m_pCurrentAnimation = (CAnimation*)animations.GetItemData(curHTreeItem);

	POINT MousePosition;
	GetCursorPos(&MousePosition);

	CExtPopupMenuWnd * popup = new CExtPopupMenuWnd;
	popup->LoadMenu(m_hWnd, IDR_BLANK, true, false);
	popup->ItemRemove(0);

	UINT ChosenItem = 0;

	// Add menu items
	popup->ItemInsertCommand(1, -1, AB_ADDNEWANIMATION, NULL, NULL);
	
	if (curHTreeItem != TVI_ROOT)
		popup->ItemInsertCommand(2, -1, AB_ADDSUBANIMATION, NULL, NULL);

	if (curHTreeItem != TVI_ROOT)
	{
		popup->ItemInsert();
		popup->ItemInsertCommand(3, -1, AB_ADDNEWANGLE, NULL, NULL);
	}

	if (curHTreeItem != TVI_ROOT)
	{
		popup->ItemInsert();
		popup->ItemInsertCommand(4, -1, REMOVE, NULL, NULL);
	}

	popup->TrackPopupMenu(TPMX_DO_MESSAGE_LOOP | TPMX_NO_WM_COMMAND | TPMX_NO_CMD_UI, MousePosition.x, MousePosition.y, NULL, NULL, NULL, &ChosenItem);
		
	if (ChosenItem == 1)
		AddAnimation();

	else if (ChosenItem == 2)
		AddSubAnimation();

	else if (ChosenItem == 3)
		AddAngle();

	else if (ChosenItem == 4)
		RemoveAnimation();
}