/*=============================================================================
		-- Updates the ScrollBar.
		=============================================================================*/
		void ScrollBar::_Update()
		{
			double oldScrollPosition = GetScrollPosition();

			//update the scroll position
			int knobLength = (mSpanDirection == SpanDirection::HORIZONTAL) ? mKnobButton.lock()->GetWidth() : mKnobButton.lock()->GetHeight();
			int knobMin = SCROLL_BAR_BUTTON_SIZE;
			int knobMax = ((mSpanDirection == SpanDirection::HORIZONTAL) ? GetWidth() : GetHeight()) - SCROLL_BAR_BUTTON_SIZE - knobLength;
			int innerRange = knobMax - knobMin;

			Vector2D<int> knobRelPos = mKnobButton.lock()->GetRelPos();
			int knobOffset = ((mSpanDirection == SpanDirection::HORIZONTAL) ? knobRelPos.x : knobRelPos.y) - SCROLL_BAR_BUTTON_SIZE;

			mScrollPosition = DivideD((double)knobOffset,(double)innerRange);

			//check if either increase/decrease button were pressed
			if (mAdjustTimer.GetTimeAndEnd() > SCROLL_BAR_ADJUST_DELAY)
			{
				if (mButtonDecrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() + 0.01);
				else if (mButtonIncrease.lock()->GetState() == State::DOWN)
					SetScrollPosition(GetScrollPosition() - 0.01);

				mAdjustTimer.Start();
			}

			if (GetScrollPosition() != oldScrollPosition)
				_SendElementMessageToListeners(ElementEvent::VALUE_CHANGED);
		}
Exemple #2
0
void Casual()
{
  do
  {
    cout << "1 = basic, 2 = decimal. x = 1,+ = 2,- = 3,% = 4.\n";
    cout << "what type of question would you like to do?" << endl;
    cout << ">";
    cin >> qtypec;

    switch (qtypec)
    {
      case 11:
      {
        MultiplyB();

        break;
      }
      case 12:
      {
        AddB();

        break;
      }
      case 13:
      {
        SubtractB();

        break;
      }
      case 14:
      {
        DivideB();

        break;
      }
      case 21:
      {
        MultiplyD();

        break;
      }
      case 22:
      {
        AddD();

        break;
      }
      case 23:
      {
        SubtractD();

        break;
      }
      case 24:
      {
        DivideD();

        break;
      }
    }
    cout << "do you want another question?(y/n)" << endl;
    cout << ">";
    cin >> ans1;

    cout << "do you what to know how many questions you got right?(y/n)" << endl;
    cout << ">";
    cin >> ans2;
    if (ans2 == 'y' || ans2 == 'Y')
    {
      cout << "your score is " << count << endl;
    }

  }
  while(ans1 == 'y' || ans1 == 'Y');
}