Exemplo n.º 1
0
		/// <summary>
		/// シーンを描画します。
		/// </summary>
		/// <returns>
		/// なし
		/// </returns>
		void drawScene() const
		{
			if (!m_current)
			{
				return;
			}

			if (m_transitionState == TransitionState::Active || !m_transitionTimeMillisec)
			{
				m_current->draw();
			}

			const double elapsed = m_stopwatch.msF();

			if (m_transitionState == TransitionState::FadeIn)
			{
				m_current->drawFadeIn(elapsed / m_transitionTimeMillisec);
			}
			else if (m_transitionState == TransitionState::FadeOut)
			{
				m_current->drawFadeOut(elapsed / m_transitionTimeMillisec);
			}
			else if (m_transitionState == TransitionState::FadeInOut)
			{
				m_current->drawFadeOut(elapsed / m_transitionTimeMillisec);

				if (m_next)
				{
					m_next->drawFadeIn(elapsed / m_transitionTimeMillisec);
				}
			}
		}
Exemplo n.º 2
0
		bool updateSingle()
		{
			double elapsed = m_stopwatch.msF();

			if (m_transitionState == TransitionState::FadeOut && elapsed >= m_transitionTimeMillisec)
			{
				m_current = nullptr;

				m_current = m_factories[m_nextState]();

				if (hasError())
				{
					return false;
				}

				m_currentState = m_nextState;

				m_transitionState = TransitionState::FadeIn;

				m_stopwatch.restart();

				elapsed = 0.0;
			}

			if (m_transitionState == TransitionState::FadeIn && elapsed >= m_transitionTimeMillisec)
			{
				m_stopwatch.reset();

				m_transitionState = TransitionState::Active;
			}

			switch (m_transitionState)
			{
			case TransitionState::FadeIn:
				assert(m_transitionTimeMillisec);
				m_current->updateFadeIn(elapsed / m_transitionTimeMillisec);
				return !hasError();
			case TransitionState::Active:
				m_current->update();
				return !hasError();
			case TransitionState::FadeOut:
				assert(m_transitionTimeMillisec);
				m_current->updateFadeOut(elapsed / m_transitionTimeMillisec);
				return !hasError();
			default:
				return false;
			}
		}
Exemplo n.º 3
0
		bool updateCross()
		{
			const double elapsed = m_stopwatch.msF();

			if (m_transitionState == TransitionState::FadeInOut)
			{
				if (elapsed >= m_transitionTimeMillisec)
				{
					m_current = m_next;

					m_next = nullptr;

					m_stopwatch.reset();

					m_transitionState = TransitionState::Active;
				}
			}

			if (m_transitionState == TransitionState::Active)
			{
				m_current->update();

				return !hasError();
			}
			else
			{
				assert(m_transitionTimeMillisec);

				const double t = elapsed / m_transitionTimeMillisec;

				m_current->updateFadeOut(t);

				if (hasError())
				{
					return false;
				}

				m_next->updateFadeIn(t);

				return !hasError();
			}
		}